* pending sms display
This commit is contained in:
60
src/App/Command/PendingCommand.php
Normal file
60
src/App/Command/PendingCommand.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user