Zend Framework 2如何设置Doctrine 2代理目录 [英] Zend Framework 2 How To Set Doctrine 2 Proxy Directory

查看:220
本文介绍了Zend Framework 2如何设置Doctrine 2代理目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在使用Zend Framework 2中的Doctrine 2模块,该模块根据Jason Grimes的turorial配置(http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/ )

So I am using Doctrine 2 module in Zend Framework 2 configured according to Jason Grimes' turorial (http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/).

有时我会收到此错误:

Your proxy directory must be writable.

我如何设置代理目录?

这是我的来自module.config.php的Doctrine配置:

Here is my Doctrine configuration from module.config.php:

'doctrine' => array(
    'driver' => array(
        __NAMESPACE__ . '_driver' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
        ),
        'orm_default' => array(
            'drivers' => array(
                __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
            ),
        ),
    ),
),


推荐答案

默认代理目录是 data / DoctrineORMModule / Proxy 。我想你知道如何使其可写,对吗?

The default proxy directory is data/DoctrineORMModule/Proxy. I guess you know how to make it writable, right?

如果您因为某些原因需要更改,可以覆盖相应的配置密钥:

If you need to change it for some reason, you can overwrite the appropriate configuration key:

<?php
return array(
    'doctrine' => array(
        'configuration' => array(
            '<YOUR DRIVER NAME (orm_default by default)>' => array(
                'proxy_dir' => 'data/DoctrineORMModule/Proxy',
                'proxy_namespace' => 'DoctrineORMModule\Proxy',
            )    
        )
    )
);
?>

希望这有帮助。

这篇关于Zend Framework 2如何设置Doctrine 2代理目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆