gpt4 book ai didi

php - 未找到类 'Doctrine\Common\Annotations\AnnotationRegistry'

转载 作者:行者123 更新时间:2023-12-04 14:22:12 33 4
gpt4 key购买 nike

我第一次使用 Doctrine 时遇到了错误。我前一天晚上离开了我的项目,这个错误不存在,在一台新机器上启动了 web 服务器并遇到了这个错误。

Fatal error: Uncaught Error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in D:\website\vendor\doctrine\orm\lib\Doctrine\ORM\Configuration.php:156 Stack trace: #0 D:\website\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(72): Doctrine\ORM\Configuration->newDefaultAnnotationDriver(Array, true) #1 D:\website\src\setup.php(16): Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(Array, true) #2 D:\website\src\bootstrap.php(6): include('C:\Users\admin\...') #3 D:\website\public\index.php(7): require('C:\Users\admin\...') #4 {main} thrown in D:\website\vendor\doctrine\orm\lib\Doctrine\ORM\Configuration.php on line 156



我试过 composer updatecomposer install ,两者都没有帮助。
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

$paths = array(ROOT . "/src/Database/Modals");
$config = $container->get('App\Providers\Config');

$dbParams = array(
'driver' => $config->get('database.driver'),
'user' => $config->get('database.user'),
'password' => $config->get('database.password'),
'dbname' => $config->get('database.name'),
);

$entityConfig = Setup::createAnnotationMetadataConfiguration($paths, true);
$entityManager = EntityManager::create($dbParams, $entityConfig);

这行代码似乎抛出了异常。
$entityConfig = Setup::createAnnotationMetadataConfiguration($paths, true);

最佳答案

@martin-barker 上面的评论对我有用:

composer require doctrine/annotations

关于php - 未找到类 'Doctrine\Common\Annotations\AnnotationRegistry',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53164747/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com