Hi I’m using Symfony DIC to configure Doctrine.
This was working perfectly fine with Doctrine 2.0, but wanted to upgrade to v2.1 and needed to add some extra configuration as seen below.
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
// new code necessary starting here
$reader->setIgnoreNotImportedAnnotations(true);
$reader->setEnableParsePhpImports(false);
My DIC configuration for the above code without my problem:
<service id="doctrine.metadriver" class="Doctrine\ORM\Mapping\Driver\AnnotationDriver">
<argument type="service">
<argument type="service" id="doctrine.cache" />
<service class="Doctrine\Common\Annotations\AnnotationReader">
<call method="setDefaultAnnotationNamespace">
<argument>Doctrine\ORM\Mapping\</argument>
</call>
<call method="setIgnoreNotImportedAnnotations">
<argument>TRUE</argument>
</call>
<call method="setEnableParsePhpImports">
<argument>FALSE</argument>
</call>
</service>
</argument>
<argument>%doctrine.entity.path%</argument>
</service>
My question is how can I add the following to the DIC configuration?
$reader = new \Doctrine\Common\Annotations\CachedReader(
new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
);
It might not be a fully working configuration but should give you some hints: