简体   繁体   中英

Issues in Doctrine ORM usage in Zend Framework

I have installed Doctrine in my ZendFramework application and kept it in the Library folder of the application. But when I try to run the application, I am getting the following error:

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

Is there any thing more that I have to do after extracting Doctrine into my application?

I have used the following link to install doctrine Bisna Doctrine2 enabled ZF1 skeleton project from Github.

Take a look in your ..\\library\\Doctrine directory and see if Doctrine.php is actually there. I doubt that it is.

I have a skeleton that I use: https://github.com/bubba-h57/secret-skeleton

and if you look at the ( https://github.com/bubba-h57/secret-skeleton/blob/master/public/index.php ) file you will see where I set up some paths to ensure that Doctrine can be found and auto-loaded. Something like this:

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

You may also want to look at: 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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM