无法在Zend Framework中加载Doctrine2 Configuration类

时间:2011-07-24 15:57:51

标签: zend-framework doctrine-orm

我正在尝试创建Configuration

$config = new \Doctrine\ORM\Configuration;

虽然我可以在Zend Studio中使用Open declaration看到这个类,但在浏览器中运行它会导致:

Fatal error: Class 'Doctrine\ORM\Configuration' not found in C:\Program Files\Zend\Apache2\htdocs\MyProject\library\Custom\Entitymanager.php on line 20

2 个答案:

答案 0 :(得分:2)

确保doctrine在include路径中,并且你在application.ini文件中有autoloadernamespaces [] =“Doctrine”

答案 1 :(得分:2)

Doctrine有一个很好的自动加载器:

require '/path/to/libraries/Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine', '/path/to/libraries');
$classLoader->register(); // register on SPL autoload stack

另见类似问题: