2011-03-05 17:33
浏览 23

教义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

Below is the _iniDoctrine() function in the Bootstrap.php file up to the line 258 referred to by the error message:

protected function _initDoctrine()


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


$autoloader = Zend_Loader_Autoloader::getInstance();

// Push the doctrine autoloader to load for the Doctrine
$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();

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.

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

图片转代码服务由CSDN问答提供 功能建议

我正在尝试将Doctrine 2设置为与ZF 1.11一起播放一段时间。 我已设法解决除一个以外的所有错误:</ p>

  PHP致命错误:在C:\ development \ porjects \ application \ Bootstrap中找不到类'Doctrine \ ORM \ Configuration'。  php在第258行
 </ code> </ pre> 

下面是Bootstrap.php文件中的_iniDoctrine()函数,直到错误消息引用的第258行:</ p>

  protected function _initDoctrine()
 $ this-&gt; bootstrap('autoload'); 
require_once('Doctrine / Common / ClassLoader.php'); 
require_once'Desstrine / Common / ClassLoader.php'; 
 $ doctrineAutoloader = array(new \ Doctrine \ Common \ ClassLoader(),  'loadClass'); 
spl_autoload_unregister($ doctrineAutoloader); 
 $ autoloader = Zend_Loader_Autoloader :: getInstance(); 
 $ autoloader-  &gt; pushAutoloader($ doctrineAutoloader,'doctrine'); 
 $ classLoader = new \ Doctrine \ Common \ ClassLoader('Entities  ',realpath(__ DIR__。  '/ models /'),'loadClass'); 
 $ autoloader-&gt; pushAutoloader(array($ classLoader,'loadClass'),'Entities'); 
 $ classLoader = new \ Doctrine \ Common \ ClassLoader  ('Symfony',realpath(__ DIR__。'/ / / library / Doctrine /'),'loadClass'); 
 $ autoloader-&gt; pushAutoloader(array($ classLoader,'loadClass'),'Symfony');  
 $ doctrineConfig = $ this-&gt; getOption('doctrine'); 
 $ config = new \ Doctrine \ ORM \ Configuration(); 
 </ code> </ pre> 

显然,应用程序无法“看到”Configuration类(和文件)。 如果我在实例化类之前手动要求该类。 另一个类/文件显示为“看不见”。 肯定不会有“手动”修复。</ p>

包含这些文件的Doctrine文件夹位于我的包含路径中。 我已经在网上搜寻了想法。 你能建议什么? 谢谢</ p> </ div>

3条回答 默认 最新

相关推荐 更多相似问题