有人可以帮助我吗?每次我要运行php bin/console server:run
命令时,都会发生此错误:
PHP致命错误:未捕获的Symfony \ Component \ Debug \ Exception \ ClassNotFoundException:尝试从命名空间“ Doctrine \ Bundle \ DoctrineCacheBundle”加载类“ DoctrineCacheBundle”。
您是否忘记了另一个名称空间的“使用”语句?在C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ src \ Kernel.php:23中
堆栈跟踪:
0 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ http-kernel \ Kernel.php(429):App \ Kernel-> registerBundles()
1 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ http-kernel \ Kernel.php(130):Symfony \ Component \ HttpKernel \ Kernel-> initializeBundles()
2 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ framework-bundle \ Console \ Application.php(159):Symfony \ Component \ HttpKernel \ Kernel-> boot()< / h1>
3 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ framework-bundle \ Console \ Application.php(65):Symfony \ Bundle \ FrameworkBundle \ Console \ Application-> registerCommands( )
4 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ src \ Kernel.php在C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ consol中
致命错误:未捕获的Symfony \ Component \ Debug \ Exception \ ClassNotFoundException:尝试从命名空间“ Doctrine \ Bundle \ DoctrineCacheBundle”加载类“ DoctrineCacheBundle”。
您是否忘记了另一个名称空间的“使用”语句?在C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ src \ Kernel.php:23中
堆栈跟踪:
0 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ http-kernel \ Kernel.php(429):App \ Kernel-> registerBundles()
1 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ http-kernel \ Kernel.php(130):Symfony \ Component \ HttpKernel \ Kernel-> initializeBundles()
2 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ framework-bundle \ Console \ Application.php(159):Symfony \ Component \ HttpKernel \ Kernel-> boot()< / h1>
3 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ framework-bundle \ Console \ Application.php(65):Symfony \ Bundle \ FrameworkBundle \ Console \ Application-> registerCommands( )
4 C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ src \ Kernel.php在C:\ Users \ XX-2 \ Desktop \ React Projects \ test_project \ vendor \ symfony \ consol中
3 个答案:
答案 0 :(得分:0)
可能是因为更新了学说包。从Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
删除此行bundles.php
,它对我有用。
答案 1 :(得分:0)
老问题,已经回答了,但在我的情况下,这是因为存储库文件是用早期的 symfony 版本创建的。
通过更改修复:
Symfony\Bridge\Doctrine\RegistryInterface
对于:
Doctrine\Persistence\ManagerRegistry
答案 2 :(得分:0)
我通过安装缺少的依赖解决了这个问题:
compose require doctrine/doctrine-cache-bundle