Symfony2 - 如何删除 Doctrine Bundle?

发布于 2024-12-08 21:56:28 字数 1127 浏览 1 评论 0原文

我目前正在使用 Symfony2 进行一个项目,并且不需要 Doctrine Bundle。我曾多次尝试删除它,但我不断收到破坏安装的错误。

我已经对应用程序目录中“Doctrine”的所有实例进行了 grep 编辑,并在以下文件中注释掉了对 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 上 第 45 行

This 引用了缓存中的这段代码

/**
 * 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 相关的任何设置。

I am currently working on a project using Symfony2 and I have no need for the Doctrine Bundle. I have tried to remove it on numerous occasions but I keep getting errors that break the install.

I have grep'ed for all instances of 'Doctrine' within the app directory and have commented out any reference to Doctrine in the following files:

  • app/config/config.yml
  • app/AppKernel.php
  • app/autoload.php

I then cleared the cache (currently working in dev mode, so removed the cache/dev directory).

The Error I am currently getting is:

Fatal error: Class 'Doctrine\Common\Annotations\FileCacheReader' not
found in
/path/to/application/app/cache/dev/appDevDebugProjectContainer.php on
line 45

This refers to this block of code in the cache

/**
 * 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);
}

but I cannot find a way to stop this from being added to the cache, as I cannot find any settings relating to the annotation_reader.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

或十年 2024-12-15 21:56:28

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

编辑:你必须自己测试。我自己从来没有尝试过。

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

  • DoctrineBundle
  • DoctrineAbstractBundle
  • SecurityExtraBundle
  • FrameworkExtraBundle
  • FrameworkBundle

请注意,这可能不值得付出努力。如果您不使用给定的服务,则不会创建它们。

Symfony uses Doctrine's annotation library. You don't need Doctrine's ORM or DBAL and you can remove them. But you need annotation reader if you use annotations anywhere in your project.

EDIT: You'll have to test it on your own. I never tried it myself.

These bundles seem to use annotation reader:

  • DoctrineBundle
  • DoctrineAbstractBundle
  • SecurityExtraBundle
  • FrameworkExtraBundle
  • FrameworkBundle

Note that it's probably not worth the effort. If you're not using given services they're not created.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文