我对php composer的了解不过是基本的,但是......我已经下载并安装了Zend Framework 3.0.0dev MVC skeleton app并想知道我是否可以安装{{3}和它一起。 composer require doctrine/doctrine-orm-module
抱怨
Problem 1
- Installation request for doctrine/doctrine-orm-module ^0.10.0 -> satisfiable by doctrine/doctrine-orm-module[0.10.0].
- doctrine/doctrine-orm-module 0.10.0 requires zendframework/zend-mvc ~2.3 -> satisfiable by zendframework/zend-mvc[2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.4.0rc5, 2.4.0rc6, 2.4.0rc7, 2.4.1, 2.4.10, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.7.0, 2.7.1, 2.7.10, 2.7.2, 2.7.3, 2.7.4, 2.7.5, 2.7.6, 2.7.7, 2.7.8, 2.7.9] but these conflict with your requirements or minimum-stability.
所以我尝试在composer.json中将zendframework / zend-mvc降级到2.7.9并再试一次:
Problem 1
- The requested package zendframework/zend-mvc (installed at 3.0.1, required as 2.7.9) is satisfiable by zendframework/zend-mvc[3.0.1] but these conflict with your requirements or minimum-stability.
Problem 2
- zendframework/zend-mvc 2.7.9 conflicts with zendframework/zend-router[3.0.2].
- zendframework/zend-mvc 2.7.9 conflicts with zendframework/zend-router[3.0.2].
- Installation request for zendframework/zend-mvc 2.7.9 -> satisfiable by zendframework/zend-mvc[2.7.9].
- Installation request for zendframework/zend-router (installed at 3.0.2) -> satisfiable by zendframework/zend-router[3.0.2].
并且我怀疑我能让作曲家高兴的原因是,这是不能做到的 - 即,学说 - orm-module不能(还)与ZF3兼容。真正?
答案 0 :(得分:3)
DoctrineORMModule 1.1.0和DoctrineModule 1.2.0已经发布。这些应该最终添加ZF3兼容性。
答案 1 :(得分:1)
问题1
- Installation request for doctrine/doctrine-orm-module ^0.11.0 -> satisfiable by doctrine/doctrine-orm-module[0.11.0].
- doctrine/doctrine-orm-module 0.11.0 requires zendframework/zend-mvc ^2.5.2 -> satisfiable by zendframework/zend-mvc[2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.7.0, 2.7.1, 2.7.10, 2.7.2, 2.7.3, 2.7.4, 2.7.5, 2.7.6, 2.7.7, 2.7.8, 2.7.9] but these conflict with your requirements or minimum-stability.
composer需要doctrine / doctrine-orm-module
在zf3-skeleton上安装
答案 2 :(得分:1)
有一个可用的包container-interop-doctrine,它与Zend服务管理器兼容(由于容器兼用程序兼容性)。
安装和使用与doctrine/doctrine-orm-module
:
composer require dasprid/container-interop-doctrine
可以通过创建新文件data/config/autoload/doctrine.global.php
:
<?php
use ContainerInteropDoctrine\EntityManagerFactory;
return [
'dependencies' => [
'factories' => [
'doctrine.entity_manager.orm_default' => EntityManagerFactory::class,
],
],
/**
* For full configuration options, see
* https://github.com/DASPRiD/container-interop-doctrine/blob/master/example/full-config.php
*/
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => [
'url' => 'mysql://user:password@localhost/database',
],
],
],
'driver' => [
'orm_default' => [
'class' => \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain::class,
'drivers' => [
'App\Entity' => 'my_entity',
],
],
'my_entity' => [
'class' => \Doctrine\ORM\Mapping\Driver\AnnotationDriver::class,
'cache' => 'array',
'paths' => 'src/App/Entity/',
],
],
],
];
一旦激活,您就可以EntityManger
获得与doctrine-orm-module
几乎相同的方式:
$serviceLocator->get('doctrine.entity_manager.orm_default');
唯一值得注意的变化是,entity_manger
代替enititymanager
。
安装/使用也有blog-post。
答案 3 :(得分:0)
您可以尝试使用fanst1109 / doctrine-orm-module
composer require fanst1109/doctrine-orm-module
它是一个提供Doctrine ORM功能的Zend Framework 3模块