61 lines
1.5 KiB
PHP
61 lines
1.5 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();
|
||
|
|
$output->writeln("<info>Pengind SMS:</info>");
|
||
|
|
$section = $output->section();
|
||
|
|
$table = new Table($section);
|
||
|
|
$table->setHeaders([
|
||
|
|
'Id',
|
||
|
|
'Text',
|
||
|
|
'Date',
|
||
|
|
]);
|
||
|
|
/** @var Sms $sms */
|
||
|
|
foreach ($pendingImports as $sms) {
|
||
|
|
$table->addRow([
|
||
|
|
$sms->getId(),
|
||
|
|
$sms->getText(),
|
||
|
|
$sms->getOccuredAt()->format("Y-m-d H:i"),
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
$table->render();
|
||
|
|
}
|
||
|
|
}
|