我不得不将现有网站移动到另一个托管(使用相同的软件)。 现在,当第二个用户尝试对实体执行某些操作(以编程方式添加,编辑或删除)时,该站点将失败并显示以下错误:
Fatal error: Class 'Entity\User' not found in /home/.../www/includes/Objects/Proxies/__CG__EntityUser.php on line 9
这是配置:
ini_set('include_path', ROOT_PATH.'/includes');
require_once(ROOT_PATH.'/includes/Doctrine/ORM/Tools/Setup.php');
Doctrine\ORM\Tools\Setup::registerAutoloadPEAR();
use Doctrine\ORM\Tools\Setup,
Doctrine\ORM\EntityManager,
Doctrine\ORM\Configuration,
Doctrine\DBAL\Event\Listeners\MysqlSessionInit;
$cache = new \Doctrine\Common\Cache\ArrayCache;
$config = new Configuration;
$driverImpl = $config->newDefaultAnnotationDriver(ROOT_PATH.'/includes/Objects');
$driverImpl->getAllClassNames();
$config->setMetadataDriverImpl($driverImpl);
$config->setProxyDir(ROOT_PATH.'/includes/Objects/Proxies');
$config->setProxyNamespace('Objects\Proxies');
// developer mode
//$config->setAutoGenerateProxyClasses(true);
$config->setQueryCacheImpl($cache);
$em = EntityManager::create(array(
'driver' => 'pdo_mysql',
'unix_socket' => '/var/lib/mysql/mysql.sock',
'charset' => 'utf8',
'host' => DB_HOST,
'user' => DB_USER,
'password' => DB_PASS,
'dbname' => DB_NAME
), $config);
$em->getEventManager()->addEventSubscriber(new MysqlSessionInit('utf8', 'utf8_unicode_ci'));
正如我所说,我在代码中没有改变任何内容......
当网站处于单用户状态时 - 一切都很好..
它能是什么?谢谢
答案 0 :(得分:1)
有时我不得不使用./doctrine orm手动创建代理:generate-proxies(在命令行工具上)
但请确保您的文件权限正确,因为有时他们会尝试自动生成但服务器不会允许它。