我目前正在开发Zend 2项目,并希望使用Doctrines FilesystemCache。
在我的module.config.php中,我有以下几行:
'doctrine' => array(
'driver' => array(
__NAMESPACE__ . '_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => array(
'filesystem' => array(
'class' => '\Doctrine\Common\Cache\FilesystemCache',
'directory' => __DIR__ . '/../data/cache/' . __NAMESPACE,
)
)
'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . ' /Entity')
),
'orm_default' => array(
'drivers' => array(
__NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
)
)
),
使用上面的配置我的实体没有被缓存,它给了我以下注意事项:
第90行/webroot/vendor/doctrine/doctrine-module/src/DoctrineModule/Options/Driver.php中的数组到字符串转换
当我将配置更改为字符串时:
'cache' => 'filesystem'
我看到FilesystemCache尝试将我的实体缓存到默认位置(?)但是失败并出现如下警告:
警告:file_put_contents(/ var / www / webroot / data / DoctrineModule / cache / e4165aec32e5 / 87e827598d3b / bdef3af2 / [File \ Entity \ File $ name @ [Annot]] [1] .doctrinecache.data):未能open stream:第111行/var/www/webroot/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php中的参数无效
答案 0 :(得分:0)
您可能应该使用__NAMESPACE__
常数而不是__NAMESPACE
没有这样的目录