教义2 + zf 1.11 [英] Doctrine 2 + zf 1.11
问题描述
我正在尝试设置教条2与ZF 1.11玩一会儿。我设法解决了除了一个以外的所有错误:
I'm trying to set up Doctrine 2 to play with ZF 1.11 for a while. I have managed to resolve all errors except one:
PHP Fatal error: Class 'Doctrine\ORM\Configuration' not found in C:\development\porjects\application\Bootstrap.php on line 258
下面是Bootstrap.php文件中的_iniDoctrine()函数,直到错误消息引用的行258:
Below is the _iniDoctrine() function in the Bootstrap.php file up to the line 258 referred to by the error message:
protected function _initDoctrine()
{
$this->bootstrap('autoload');
require_once('Doctrine/Common/ClassLoader.php');
// Create the doctrine autoloader and remove it from the spl autoload stack (it adds itself)
require_once 'Doctrine/Common/ClassLoader.php';
$doctrineAutoloader = array(new \Doctrine\Common\ClassLoader(), 'loadClass');
spl_autoload_unregister($doctrineAutoloader);
$autoloader = Zend_Loader_Autoloader::getInstance();
// Push the doctrine autoloader to load for the Doctrine\ namespace
$autoloader->pushAutoloader($doctrineAutoloader, 'doctrine');
$classLoader = new \Doctrine\Common\ClassLoader('Entities', realpath(__DIR__ . '/models/'), 'loadClass');
$autoloader->pushAutoloader(array($classLoader, 'loadClass'), 'Entities');
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', realpath(__DIR__ . '/../library/Doctrine/'), 'loadClass');
$autoloader->pushAutoloader(array($classLoader, 'loadClass'), 'Symfony');
$doctrineConfig = $this->getOption('doctrine');
$config = new \Doctrine\ORM\Configuration();
显然,应用程序无法查看Configuration类(和文件)。如果我在实例化类之前手动要求类。另一个类/文件出现'看不见'。 手动修复绝对不会。
Apparently, the application fails to 'see' the Configuration class (and file). If I manually require the class before the class is instantiated. Another Class/file appears 'unseen'. A 'manual' fix definitely would not do.
包含这些文件的Doctrine文件夹位于我的包含路径上。我已经浏览了网络的想法。你会建议什么?谢谢
The Doctrine folder which contains these files is on my include path. I have scoured the web for ideas. What please would you suggest? Thanks
推荐答案
我实现使ZF 1.x& Doctrine 2使用此应用程序资源,共同合作可以在 github 上获得,并记录在案。
I achieve to make ZF 1.x & Doctrine 2 working great together using this application resource it is available on github and well documented.
希望有帮助
这篇关于教义2 + zf 1.11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!