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 er开发者_JS百科ror: 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
.
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.
You might wanna have a look at: http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1
and
http://silex.sensiolabs.org/
;)
精彩评论