3
votes

I'm trying to set up the Symfony CMF with Doctrine PHPCR-ODM. Unfortunately, whenever I want to save some data from Sonata Admin into the database, I get the following exception:

Compile Error: Doctrine\Common\Proxy\AbstractProxyFactory::getProxyDefinition():
    Failed opening required 
    '/Applications/XAMPP/xamppfiles/htdocs/app/cache/dev/doctrine/PHPCRProxies/__CG__DoctrineODMPHPCRDocumentGeneric.php'

I have initialized the repository multiple times and deleted the cache too, but nothing helped.

Does anybody have an idea, why this file is missing? How could this file being generated?

1

1 Answers

2
votes

I found out what the problem was.

In the config file of Symfony2, I had to add the following:

doctrine_phpcr:
    odm:
        auto_generate_proxy_classes: "%kernel.debug%"

For Production environment,you have to call php app/console cache:warmup to generate the proxy classes for the documents in advance.

It should be done like this to minimize the work in the production environment.