namespace App\Command;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
final class TestCommand extends Command
{
protected static $defaultName = 'app:test-command';
/**
* @var EntityManagerInterface
*/
private $entityManager;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
parent::__construct();
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|void|null
* @throws \Doctrine\DBAL\DBALException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$conn = $this->entityManager->getConnection();
$sql = 'SELECT * FROM invoice WHERE status = :status';
$stmt = $conn->prepare($sql);
$stmt->execute(['status' => 'transaction_failed']);
$invoices = $stmt->fetchAll();
dd($invoices);
}
}