Doctrine Proxy not found
I am trying to setup Symfony CMF using Doctrine PHPCR-ODM. Unfortunately, when I want to save some data from Sonata Admin to 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 initialized the repository several times and also deleted the cache, but nothing helped.
Does anyone have an idea why this file is missing? How can this file be created?
+3
source to share
1 answer
I figured out what the problem is.
In the symfony2 config file, I had to add the following:
doctrine_phpcr:
odm:
auto_generate_proxy_classes: "%kernel.debug%"
For a production environment, you should call php app/console cache:warmup
to pre-create proxy classes for documents.
This should be done in a way that minimizes work in the production environment.
+2
source to share