【发布时间】:2026-02-14 03:30:01
【问题描述】:
我目前正在使用 Symfony2 进行项目,我不需要 Doctrine Bundle。我曾多次尝试删除它,但我不断收到破坏安装的错误。
我已经对 app 目录中的所有 'Doctrine' 实例进行了 grep'ed,并在以下文件中注释掉了对 Doctrine 的任何引用:
- app/config/config.yml
- app/AppKernel.php
- app/autoload.php
然后我清除了缓存(当前工作在 dev 模式,所以删除了 cache/dev 目录)。
我目前遇到的错误是:
致命错误:类 'Doctrine\Common\Annotations\FileCacheReader' 不是 在发现 /path/to/application/app/cache/dev/appDevDebugProjectContainer.php on 第 45 行
这里指的是缓存中的这段代码
/**
* Gets the 'annotation_reader' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return Doctrine\Common\Annotations\FileCacheReader A Doctrine\Common\Annotations\FileCacheReader instance.
*/
protected function getAnnotationReaderService()
{
return $this->services['annotation_reader'] = new \Doctrine\Common\Annotations\FileCacheReader(new \Doctrine\Common\Annotations\AnnotationReader(), '/path/to/application/app/cache/dev/annotations', true);
}
但我找不到阻止它被添加到缓存中的方法,因为我找不到与 annotation_reader 相关的任何设置。
【问题讨论】:
-
我怀疑它实际上无法删除。你真的需要删除它吗?你不能忽略它吗?
-
我想我可以忽略它,但更愿意在项目中只包含项目实际使用的包。
-
我同意,因为 S2 是基于捆绑包构建的,所以我认为它应该是可移动的。如果您想使用非原则数据存储会发生什么。