我正在尝试将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命名空间,我可以找到DoctrineModule
(grep "namespace DoctrineModule" -R ./vendor
查找内容)的命名空间,但不能找到DoctrineORMModule
(grep "namespace DoctrineORMModule" -R ./vendor
没有'吨)。
为了将DoctrineORMModule
与ZF2 RC2
进行整合,我缺少什么?
答案 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