Partage
  • Partager sur Facebook
  • Partager sur Twitter

[Symfony5] Erreur PDO commande personnalisé

could not find driver

Sujet résolu
    20 septembre 2021 à 12:40:47

    Bonjour,

    Voici mon erreur lors de l’exécution d'un command personnalisé :

    $ php bin/console app:check-trans
    -------Start ETH-------
    
    In AbstractMySQLDriver.php line 128:
                                                              
      An exception occurred in driver: could not find driver  
                                                              
    
    In Exception.php line 18:
                             
      could not find driver  
                             
    
    In PDOConnection.php line 40:
                             
      could not find driver  

    Le reste de l'application marche niquel, la configuration de la BD sur le .env est ok.

    Voici une partie du fichier command.php :

    <?php
    namespace App\Command;
    
    use App\Service\CheckTransactionsService;
    use App\Service\TatumService;
    use Symfony\Component\Console\Command\Command;
    use Symfony\Component\Console\Input\InputInterface;
    use Symfony\Component\Console\Output\OutputInterface;
    
    class CheckTransactionsCommand extends Command
    {
        // the name of the command (the part after "bin/console")
        protected static $defaultName = 'app:check-transac';
    
        private $tatum;
    
        private $checkTransactionsService;
    
    
        public function __construct(TatumService $tatumService, CheckTransactionsService $checkTransactionsService)
        {
           
           $this->checkTransactionsService = $checkTransactionsService;
            $this->tatum = $tatumService;
            parent::__construct();
        }
    
        protected function configure(): void
        {
            // ...
        }
    
        protected function execute(InputInterface $input, OutputInterface $output): int
        {
            $output->writeln('-------Start ETH-------');
            $ethTransactions = $this->tatum->getTransactionsEth();
    
            $airnextAde = '0xBAb83743e502B5C83186602E33b7511b0647977a';
            $output->writeln($ethTransactions);
            $parameters = json_decode($ethTransactions, true);
            if (!$parameters){
                $output->writeln('Error : Data manquante');
            }
            $output->writeln('Parameters not null');
            $block = $this->checkTransactionsService->block('eth');


    l'erreur intervient ici lors de l'appel du service checkTransactionsService->block()

    Voici le code de la function -> 

    <?php
    
    namespace App\Service;
    
    use App\Entity\Transactions;
    use App\Entity\User;
    use App\Repository\BlockRepository;
    use App\Repository\TransactionsRepository;
    use App\Repository\WalletsRepository;
    use Doctrine\ORM\EntityManagerInterface;
    
    class CheckTransactionsService
    {
        private $em;
    
        private $transactions;
    
        private $wallets;
    
        private $block;
    
        public function __construct(EntityManagerInterface $em, TransactionsRepository $transactionsRepository, WalletsRepository $walletsRepository, BlockRepository $blockRepository)
        {
            $this->em = $em;
            $this->transactions = $transactionsRepository;
            $this->wallets = $walletsRepository;
            $this->block = $blockRepository;
        }
    
        public function block($currency)
        {
            return $this->block->findOneBy(['currency' => $currency]);
        }

    Je ne comprend pas trop pour quoi cette erreur ?

    Merci de votre aide.

    • Partager sur Facebook
    • Partager sur Twitter

    [Symfony5] Erreur PDO commande personnalisé

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown