在ZF2 RC2上安装Doctrine ORM模块的问题

时间:2012-08-03 07:58:05

标签: zend-framework doctrine-orm zend-framework2

我正在尝试将DoctrineORMModule模块与ZF2 RC2集成,但我遇到了问题。我的./composer.json如下,php composer.phar update正常运行:

"require": {
    "php": ">=5.3.3",
    "doctrine/data-fixtures": "dev-master",
    "doctrine/doctrine-module": "dev-master",
    "doctrine/orm": ">2.2,<2.4-dev",
    "doctrine/dbal": ">2.2,<2.4-dev",
    "doctrine/migrations": "dev-master",
    "zendframework/zendframework": "dev-master#a59928a3a37e420193939f9799ece27fb39bb84e"
},
"autoload": {
    "psr-0": {
        "DoctrineORMModule": "src/",
        "DoctrineORMModuleTest": "tests/"
    }
}

然而,添加到./application/application.config.php的其中一个模块导致了问题:

'modules' => array(
    'Application',
    'DoctrineModule',    // WORKS FINE
    'DoctrineORMModule', // 'Module (DoctrineORMModule) could not be initialized.'
),

当我发出./vendor/bin/doctrine-module命令时,这已得到确认:

  

PHP致命错误:未捕获的异常   'Zend \ ModuleManager \ Exception \ RuntimeException',带有消息'Module   (DoctrineORMModule)无法初始化。在   ./vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php:139

如果我在vendor目录中搜索Doctrine命名空间,我可以找到DoctrineModulegrep "namespace DoctrineModule" -R ./vendor查找内容)的命名空间,但不能找到DoctrineORMModulegrep "namespace DoctrineORMModule" -R ./vendor没有'吨)。

为了将DoctrineORMModuleZF2 RC2进行整合,我缺少什么?

2 个答案:

答案 0 :(得分:3)

你忘了要求“doctrine / doctrine-orm-module”

DoctrineModule包含一堆抽象类,可以为ORM / MongoDB和其他数据库提供相同的API。

在此处阅读有关安装DoctrineORMModule的更多信息 https://github.com/doctrine/DoctrineORMModule

答案 1 :(得分:0)

我认为你只需要添加

"doctrine/DoctrineORMModule": "dev-master"

像这样

{
    "name": "zendframework/skeleton-application",
    "description": "Skeleton Application for ZF2",
    "license": "BSD-3-Clause",
    "keywords": [
        "framework",
        "zf2"
    ],
    "homepage": "http://framework.zend.com/",
    "require": {
        "php": ">=5.3.3",
        "zendframework/zendframework": "dev-master#a59928a3a37e420193939f9799ece27fb39bb84e",
        "doctrine/DoctrineORMModule" : "dev-master"
    }
}

然后运行

  

php composer.phar update