When to fold PROD cache on the server get the error Doctrine Proxy, while on the local host, all performed without error. Reset DEV cache on both hosts also successfully reset.
"require": {
"php": ">=5.3.3",
"symfony/symfony": "v2.7.3",
"doctrine/orm": "v2.5.0",
"doctrine/doctrine-bundle": "v1.5.1",
"twig/extensions": "v1.3.0",
"symfony/assetic-bundle": "v2.3.1",
"symfony/swiftmailer-bundle": "v2.3.8",
"symfony/monolog-bundle": "v2.7.1",
"sensio/distribution-bundle": "v3.0.30",
"sensio/framework-extra-bundle": "v3.0.10",
"incenteev/composer-parameter-handler": "v2.1.1",
"friendsofsymfony/user-bundle": "v2.0.0-alpha3",
"knplabs/knp-paginator-bundle": "2.5.0",
"gregwar/image-bundle": "v2.0.21",
"sensio/buzz-bundle": "v1.0.0",
"whiteoctober/breadcrumbs-bundle": "1.2.0",
"sonata-project/admin-bundle": "2.3.3",
"sonata-project/doctrine-orm-admin-bundle": "2.3.2",
"sonata-project/translation-bundle": "1.0.0",
"sonata-project/doctrine-extensions": "1.0.2",
"iphp/filestore-bundle" : "v0.2.5",
"sonata-project/intl-bundle": "2.2.2",
"oro/doctrine-extensions": "1.0.8",
"devcookies/signgen": "^1.0",
"gedmo/doctrine-extensions": "^2.4"
},
My observations №1
Run the console command for clearing PROD cache:
sudo php app/console cache:clear -e prod
get error
PHP Warning: require(/var/www/site.com/www/app/cache/pro_/doctrine/orm/Proxies/__CG__AppMerchantBundleEntityProject.php): failed to open stream: No such file or directory in /var/www/site.com/www/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 209 PHP Fatal error: require(): Failed opening required '/var/www/site.com/www/app/cache/pro_/doctrine/orm/Proxies/__CG__AppMerchantBundleEntityProject.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/site.com/www/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 209 [2016-01-29 10:30:55] php.CRITICAL: Fatal Compile Error: require(): Failed opening required '/var/www/site.com/www/app/cache/pro_/doctrine/orm/Proxies/__CG__AppMerchantBundleEntityProject.php' (include_path='.:/usr/share/php:/usr/share/pear') {"type":64,"file":"/var/www/site.com/www/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php","line":209,"level":6143,"stack":[]} {"request_ip":"unavailable","client_ip":"unavailable"} PHP Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Compile Error: require(): Failed opening required '/var/www/site.com/www/app/cache/pro_/doctrine/orm/Proxies/__CG__AppMerchantBundleEntityProject.php' (include_path='.:/usr/share/php:/usr/share/pear')' in /var/www/site.com/www/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:209 Stack trace:
0 {main} thrown in /var/www/site.com/www/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
on line 209
Run the console command for clearing DEV cache:
sudo php app/console cache:clear -e dev
It's all right, and no errors
My observations №2
When in the configuration file, change the setting Doctrine
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
types:
json: Sonata\Doctrine\Types\JsonType
mapping_types:
enum: string
orm:
auto_generate_proxy_classes: "%kernel.debug%"
...
Changed config:
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
types:
json: Sonata\Doctrine\Types\JsonType
mapping_types:
enum: string
orm:
auto_generate_proxy_classes: true
...
PROD cache is flushed without an error
My observations №3
The recent amendments of code that actually all broken and added two related entities:
Project entity
<?php
namespace App\MerchantBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\CoreBundle\Entity\Cashbox;
use App\PaymentBundle\Entity\Cash\Template;
use App\MerchantBundle\Entity\Project\Terminal;
/**
* Project
*
* @ORM\Table(name="merchant_projects", uniqueConstraints={@ORM\UniqueConstraint(name="id_UNIQUE", columns={"id"}), @ORM\UniqueConstraint(name="secret_key_UNIQUE", columns={"secret_key"}), @ORM\UniqueConstraint(name="merchant_id_UNIQUE", columns={"merchant_id"})})
* @ORM\Entity
*/
class Project
{
...
/**
* @ORM\OneToMany(targetEntity="\App\MerchantBundle\Entity\Project\Domain", mappedBy="project")
*/
private $domains;
...
And Domain entity
<?php
namespace App\MerchantBundle\Entity\Project;
use Doctrine\ORM\Mapping as ORM;
/**
* Domain
*
* @ORM\Table(name="merchant_project_domains")
* @ORM\Entity
*/
class Domain
{
...
/**
* @var \App\MerchantBundle\Entity\Project
*
* @ORM\ManyToOne(targetEntity="\App\MerchantBundle\Entity\Project", inversedBy="domains")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="project_id", referencedColumnName="id")
* })
*/
private $project;
If you remove a connection Domain entity
/**
* @var \App\MerchantBundle\Entity\Project
*/
private $project;
It's all right, and no errors