我正在尝试按照以下步骤部署一个 symfony 项目:
./composer.phar update
php bin/console cache:clear
我也尝试过手动安装运行 Doctrine 驱动ArrayCache:
./composer.phar require doctrine/cache
结果总是一样的,我最终得到以下错误:
# ./composer.phar update --no-interaction
[...]
Script cache:clear returned with error code 255
!!
!! In ContainerBuilder.php line 1089:
!!
!! Class Doctrine\Common\Cache\ArrayCache does not exist
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
我是 symfony 的新手,我不明白为什么缺少这个类。
我正在使用以下版本:
"symfony/framework-bundle": "5.1.*",
"doctrine/doctrine-bundle": "^2.2",
提前感谢您的帮助。
最佳答案
我认为你在安装 "doctrine/doctrine-bundle": "^2.2",
时安装了 doctrine/cache
2.x 版本。
来自 github page :
此库已弃用,将不再接收来自 Doctrine 项目的错误修复。请使用不同的缓存库,最好是 PSR-6 或 PSR-16。
所以你有下一个选择:
- ./composer.phar 需要 Doctrine/缓存:^1.11
- 使用其他库进行缓存,例如 symfony/cache
关于php - 安装 symfony 项目时“类 Doctrine\Common\Cache\ArrayCache 不存在”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68166221/