2013-03-26 90 views
0

我在ZendFramework應用程序中安裝了Doctrine並將其保存在應用程序的Library文件夾中。但是,當我嘗試運行應用程序時,我收到以下錯誤:Zend Framework中Doctrine ORM用法的問題

Warning: require_once(Doctrine/Doctrine.php): failed to open stream: No such file or directory in /var/www/square-06/application/Bootstrap.php on line 7 Fatal error: require_once(): Failed opening required 'Doctrine/Doctrine.php' (include_path='/var/www/square-06/application/../library:/var/www/square-06/library:.:/usr/share/php:/usr/share/pear') in /var/www/square-06/application/Bootstrap.php on line 7

有什麼東西被我提取主義到我的應用程序後做什麼?

我已經使用以下鏈接從Github安裝doctrine Bisna Doctrine2 enabled ZF1 skeleton project

回答

1

看看你的.. \ library \ Doctrine目錄,看看Doctrine.php是否真的存在。我懷疑它是什麼。

我有我使用的骨架:https://github.com/bubba-h57/secret-skeleton

,如果你看一下(https://github.com/bubba-h57/secret-skeleton/blob/master/public/index.php)文件,你會看到我的設置一些通道,確保學說,可以發現和自動加載。事情是這樣的:

// Define application environment 
defined('APPLICATION_ENV') 
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); 

// Define path to application directory 
defined('APPLICATION_PATH') 
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); 

// Define path to Zend library directory 
defined('ZEND_LIB_PATH') 
|| define('ZEND_LIB_PATH', realpath(dirname(__FILE__) . '/../library/vendor/zend/framework/1.11.12/library')); 

// Define path to the user library directory 
defined('USER_LIB_PATH') 
|| define('USER_LIB_PATH', realpath(dirname(__FILE__) . '/../library')); 

// Define path to the user resource directory 
defined('USER_RES_PATH') 
|| define('USER_RES_PATH', realpath(dirname(__FILE__) . '/../resources')); 

// Define path to the zf1-doctrine2 library directory 
defined('ZF1D2_LIB_PATH') 
|| define('ZF1D2_LIB_PATH', realpath(dirname(__FILE__) . '/../library/vendor/zf1-d2/library')); 

// Ensure library/ is on include_path 
set_include_path(implode(PATH_SEPARATOR, array(
ZEND_LIB_PATH, 
USER_LIB_PATH, 
ZF1D2_LIB_PATH, 
))); 

/** Zend_Application */ 
require_once 'Zend/Application.php'; 

// Create application, bootstrap, and run 
$application = new Zend_Application(
APPLICATION_ENV, 
APPLICATION_PATH . '/configs/application.ini' 
); 
$application->bootstrap() 
     ->run(); 

您可能還需要查看: http://www.thecodehouse.com/2011/03/25/installing-doctrine-orm-in-a-zend-framework-application/ http://phphints.wordpress.com/2011/07/10/getting-bisna-to-work-with-doctrinecommon-2-1-0/

+0

其中Doctrine.php所在的路徑是:'在/ var/WWW /平方米-06 /庫/教義/庫/ ZFDoctrine /應用程序/資源「 我應該在任何地方指定此路徑或更改任何地方,請告訴 – user2176313 2013-03-28 06:10:48

+0

我更新了答案,其中有兩個額外的鏈接對我有幫助,當我第一次開始將Doctrine集成到Zendframework時。你在應用程序/資源目錄中的事實表明你正在配置一個排序插件。我不知道如何幫助你,你有一個github鏈接,我可以看到整個項目的佈局和配置? – bubba 2013-03-28 14:46:49

+0

這裏是代碼,請查看它並添加/刪除文件夾,你覺得有必要'https://github.com/Zendy4009/secret- octo-wight' – user2176313 2013-03-29 12:30:02