0

我不得不将现有站点移动到另一个主机(使用相同的软件)。现在,当第二个用户尝试对实体执行某些操作(以编程方式添加、编辑或删除)时,站点将失败并出现以下错误:

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

正如我所说,我没有改变任何代码......

当网站处于单用户状态时 - 一切都很好..

会是什么?谢谢

4

1 回答 1

1

有时我不得不使用 ./doctrine orm:generate-proxies 手动创建代理(在命令行工具上)

但请确保您的文件权限正确,因为有时它们会尝试自动生成,但服务器不允许这样做。

于 2013-09-16T16:00:54.753 回答