63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Command;
|
|
|
|
use App\Entity\Sms;
|
|
use App\Service\SmsStoreService;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Helper\Table;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
class PendingCommand extends Command
|
|
{
|
|
/**
|
|
* @var SmsStoreService
|
|
*/
|
|
private $smsStoreService;
|
|
|
|
public function __construct(SmsStoreService $smsStoreService)
|
|
{
|
|
$this->smsStoreService = $smsStoreService;
|
|
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function configure()
|
|
{
|
|
$this->setName('pending:show')
|
|
->setDescription('Show failed koin import SMS entries');
|
|
}
|
|
|
|
/**
|
|
* @param InputInterface $input
|
|
* @param OutputInterface $output
|
|
* @return int|null|void
|
|
*/
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$pendingImports = $this->smsStoreService->getFailedImports();
|
|
$section = $output->section();
|
|
$table = new Table($section);
|
|
$table->setHeaderTitle("<info>Pengind SMS:</info>");
|
|
$table->setHeaders([
|
|
'Id',
|
|
'Text',
|
|
'Date',
|
|
]);
|
|
$table->setColumnMaxWidth(1, 80);
|
|
$table->setColumnMaxWidth(2, 18);
|
|
/** @var Sms $sms */
|
|
foreach ($pendingImports as $sms) {
|
|
$table->addRow([
|
|
$sms->getId(),
|
|
$sms->getText(),
|
|
$sms->getOccuredAt()->format("Y-m-d H:i"),
|
|
]);
|
|
}
|
|
$table->render();
|
|
}
|
|
}
|