php - Symfony 5:驱动程序发生异常:找不到驱动程序
问题描述
我在 symfony 上创建了一个命令,我需要使用“EntityManagerInterface”,才能应用到存储库。
应用程序的所有其余部分工作正常,与数据库的连接以及 php 的 mysql 扩展都正常。
<?php
namespace App\Command;
use App\Entity\Block;
use App\Service\TatumService;
use Doctrine\ORM\EntityManagerInterface;
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 $em;
private $buyToken;
public function __construct(TatumService $tatumService, EntityManagerInterface $em)
{
$this->em = $em;
$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();
$blockRepository = $this->em->getRepository(Block::class)->findAll();
}
}
我有以下错误:
$ 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
bdd 配置没问题,因为应用程序的其余部分工作正常。
当我不使用 ->findall() 时。该脚本工作正常。
谢谢你的帮助。
解决方案
推荐阅读
- operator-keyword - <> 运算符在 Chisel 中的方向?
- three.js - RGBELoader 纹理质量低 - 256 x 256
- arrays - 在 PyCuda 的 SourceModule 中创建数组
- java - Eclipse IDE:无法加载资源,因为应用程序传输安全策略需要使用安全连接
- json - 使用 JQ 将 json 转换为 csv 时向每一行添加字符串
- python - 请帮我用选择描述写一个程序,根据用户输入的月份显示对应的四个季节
- reactjs - 读取 excel 文件时出现问题(fs readFilesync 错误)
- cakephp - 将蛋糕 2 升级到 3
- sql - 当日期字段为空时,我想将其设置为今天的日期
- sas - 输入文本文件,缺少输出日期格式