2011-03-05 121 views
0

我試圖設置Doctrine 2與ZF 1.11玩一段時間。我已成功地解決除此之外的所有錯誤:學說2 + zf 1.11

PHP Fatal error: Class 'Doctrine\ORM\Configuration' not found in C:\development\porjects\application\Bootstrap.php on line 258 

下面是在bootstrap.php中的_iniDoctrine()函數文件達到由錯誤消息中提到的行258:

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

顯然,應用程序無法'查看'配置類(和文件)。如果我在實例化類之前手動要求該類。另一個類/文件出現「看不見」。 '手動'修復絕對不會。

包含這些文件的Doctrine文件夾位於我的包含路徑中。我在網上搜索了一些想法。你會建議什麼?謝謝

回答

1

如果您正在尋找整合原則2 + Zend框架,你可能希望使用的原則開發商提供的「膠水」(Guilherme的布蘭科) https://github.com/guilhermeblanco/ZendFramework1-Doctrine2

如果您還沒有看到拉爾夫辛德勒和吉列爾梅布蘭科的演講,有一個關於Slideshare的演講。 http://www.slideshare.net/ralphschindler/zend-framework-1-doctrine-2-6177485

此外,Ralph在Github上有一個很好的示例應用程序。 https://github.com/ralphschindler/NOLASnowball/tree/doctrine2-managed-crud#

0

ZendCasts上還有一個關於如何實施Guilerme適配器的精彩視頻。尋找單元測試學說2實體。