我想在Zend Framework-Application中使用Doctrine 2和"l3pp4rd/DoctrineExtensions".但我只收到以下错误消息:
Entities\USER_User类中的注释"@Doctrine\ORM\Mapping\Entity"不存在,或者无法自动加载.
应用程序\ bootstrap.php中
protected function _initDoctrine() {
require_once('Doctrine/Common/ClassLoader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
$classLoader = array(new \Doctrine\Common\ClassLoader('Doctrine'), 'loadClass');
$autoloader->pushAutoloader($classLoader, 'Doctrine\\');
$classLoader = new \Doctrine\Common\ClassLoader('Entities',
realpath(Zend_Registry::get('config')->resources->entityManager->connection->entities), 'loadClass');
$autoloader->pushAutoloader(array($classLoader, 'loadClass'), 'Entities');
$classLoader = new \Doctrine\Common\ClassLoader('Repositories',
realpath(Zend_Registry::get('config')->resources->entityManager->connection->entities), 'loadClass');
$autoloader->pushAutoloader(array($classLoader, 'loadClass'), 'Repositories');
}
Run Code Online (Sandbox Code Playgroud)
在http://www.gediminasm.org/article/annotation-reference上找到了库\ My\Resource\Entitymanager.php
class My_Resource_Entitymanager extends Zend_Application_Resource_ResourceAbstract
{
public function init()
{
// WARNING: setup, assumes that autoloaders are set
// configuration settings from the application.ini file
$zendConfig = new Zend_Config($this->getOptions());
// globally used cache driver, in production use …Run Code Online (Sandbox Code Playgroud)