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()
);