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

查看:25
本文介绍了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/).

有时我会不断收到此错误:

Sometimes I keep getting this error though:

您的代理目录必须是可写的.

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' => 'DoctrineORMMappingDriverAnnotationDriver',
            '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' => 'DoctrineORMModuleProxy',
            )    
        )
    )
);
?>

希望这会有所帮助.

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

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