Symfony2 - How to remove a bunch of doctrines?

I am currently working on a project using Symfony2 and I do not need the Doctrine Bundle package. I tried to remove it in many cases, but I keep getting errors that violate the installation.

I have grep'ed for all instances of Doctrine in the application directory and commented on any link to Doctrine in the following files:

  • application /Config/config.yml
  • application /AppKernel.php
  • application /autoload.php

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

The error I'm getting right now: 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 canโ€™t find a way to stop this adding to the cache, because I canโ€™t find any parameters related to annotation_reader.

Can anyone help?

+4
source share
2 answers

Symfony uses the Doctrine annotation library. You do not need Doctrine ORM or DBAL, and you can delete them. But you need an annotator if you use annotations anywhere in your project.

EDIT: You will have to test it yourself. I have never tried this myself.

These bundles seem to use the annotation reader:

  • Doctrinebundle
  • DoctrineAbstractBundle
  • SecurityExtraBundle
  • FrameworkExtraBundle
  • Frameworkbundle

Please note that this is probably not worth the effort. If you do not use these services, they are not created.

+5
source

All Articles