相关疑难解决方法(0)

Entities\USER_User类中的注释"@Doctrine\ORM\Mapping\Entity"不存在,或者无法自动加载

我想在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)

php zend-framework doctrine-orm

5
推荐指数
1
解决办法
9369
查看次数

标签 统计

doctrine-orm ×1

php ×1

zend-framework ×1