0
嗨我正在使用Symfony DIC配置原则。 这对于Doctrine 2.0来说工作得很好,但是想升级到V2.1并需要添加一些额外的配置,如下所示。如何用Symfony依赖注入容器配置Doctrine 2.1?
$ reader = new \ Doctrine \ Common \ Annotations \ AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
// new code necessary starting here
$reader->setIgnoreNotImportedAnnotations(true);
$reader->setEnableParsePhpImports(false);
上面的代码没有我的问题,我的DIC配置:
<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>
我的问题是我怎么可以添加以下到DIC配置?
$reader = new \Doctrine\Common\Annotations\CachedReader(
new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
);