0

我对 php composer 的了解只是基本的,但是……我已经下载并安装了 Zend Framework 3.0.0dev MVC 框架应用程序,并想知道我是否可以安装Doctrine ORM 模块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。真的?

4

4 回答 4

3

DoctrineORMModule 1.1.0DoctrineModule 1.2.0已经发布。这些最终应该会增加 ZF3 的兼容性。

于 2016-06-29T18:52:49.413 回答
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.

作曲家需要学说/学说-orm-module

安装在 zf3-skeleton 上

于 2016-07-05T14:29:14.473 回答
1

有一个可用的包container-interop-doctrine,它与 Zend Service Manger 兼容(由于 container-interop 兼容性)。

安装和使用非常类似于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.

还有一个安装/使用的博客文章

于 2016-07-05T19:08:20.070 回答
0

你可以试试 fanst1109/doctrine-orm-module

composer require fanst1109/doctrine-orm-module

它是一个 Zend Framework 3 模块,提供 Doctrine ORM 功能

于 2016-07-14T16:10:13.313 回答