Symfony2 - 如何删除Doctrine Bundle?

ste*_*eah 5 doctrine bundle symfony

我目前正在使用Symfony2进行一个项目,我不需要Doctrine Bundle.我试图在很多场合删除它,但我不断收到错误,打破了安装.

我已经对app目录中的所有"Doctrine"实例进行了grep'ed,并在以下文件中注释掉了对Doctrine的任何引用:

  • 应用程序/配置/ config.yml
  • 应用程序/ AppKernel.php
  • 应用程序/ autoload.php

然后我清除了缓存(当前在开发模式下工作,因此删除了缓存/ dev目录).

我目前得到的错误是:致命错误:第45行的/path/to/application/app/cache/dev/appDevDebugProjectContainer.php中找不到类'Doctrine\Common\Annotations\FileCacheReader'

这指的是缓存中的这个代码块

/**
 * 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);
}
Run Code Online (Sandbox Code Playgroud)

但我无法找到一种方法来阻止将其添加到缓存中,因为我找不到与annotation_reader相关的任何设置.

谁能帮忙?

Jak*_*las 5

Symfony使用Doctrine的注释库.您不需要Doctrine的ORM或DBAL,您可以删除它们.但是,如果在项目中的任何位置使用注释,则需要注释阅读器.

编辑:你必须自己测试它.我自己从未尝试过.

这些包似乎使用注释阅读器:

  • DoctrineBundle
  • DoctrineAbstractBundle
  • SecurityExtraBundle
  • FrameworkExtraBundle
  • FrameworkBundle

请注意,这可能不值得.如果您没有使用给定的服务,则不会创建它们.