Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
788 views
in Technique[技术] by (71.8m points)

php - Zend Framework 2 How To Set Doctrine 2 Proxy Directory

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.

How can I set the proxy directory?

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'
            ),
        ),
    ),
),
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

Hope this helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...