0

My knowledge of php composer is no more than basic, but... I've downloaded and installed the Zend Framework 3.0.0dev MVC skeleton app and wanted to find out if I could install the Doctrine ORM module along with it. composer require doctrine/doctrine-orm-module complains about

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.

so I try downgrading zendframework/zend-mvc to 2.7.9 in composer.json and try again:

 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].

and I suspect that the reason I can't make composer happy is that this just cannot be done -- i.e., doctrine-orm-module is not (yet) compatible with ZF3. True?

David
  • 815
  • 8
  • 18

4 Answers4

3

DoctrineORMModule 1.1.0 and DoctrineModule 1.2.0 have been released. These should finally add ZF3 compatibility.

xtreamwayz
  • 1,285
  • 8
  • 10
  • that's all I needed to know. After posting this I came across your illuminating https://xtreamwayz.com/blog/2015-12-12-setup-doctrine-for-zend-expressive and was going to play around with that. I'm a noob to Expressive and ZF3 but it looks like the concepts in your post are similar to what will be needed to integrate DoctrineORMModule with ZF3. – David Jun 30 '16 at 15:44
  • 1
    My misstake. They support now zend-servicemanager 3 but not yet zend-mvc 3 which is needed for ZF3. – xtreamwayz Jul 05 '16 at 15:05
  • I was just looking at https://github.com/doctrine/DoctrineModule/pull/564 and as a bit of a noob with all things git I want to make sure I understand correctly that as of now (13-sep-2016) we are still standing by for ZF3 support. True? – David Sep 13 '16 at 13:48
  • DoctrineORMModule 1.1.0 and DoctrineModule 1.2.0 have been released. This should finally add ZF3 compatibility. – xtreamwayz Oct 04 '16 at 07:15
1

Problem 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 require doctrine/doctrine-orm-module

install on zf3-skeleton

Vasfed
  • 18,013
  • 10
  • 47
  • 53
Diego
  • 11
  • 1
1

There is a package container-interop-doctrine available, that is compatible with the Zend Service Manger (due to the container-interop compability).

Installation and usage is pretty similar to the doctrine/doctrine-orm-module:

composer require dasprid/container-interop-doctrine

It can be activated by by creating a new file 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/',
            ],
        ],
    ],
];

Once activated, you can get the EntityManger almost the same way as with the doctrine-orm-module:

$serviceLocator->get('doctrine.entity_manager.orm_default');

The only noticable change is, that entity_manger instead of enititymanager.

There's a blog-post for installation / usage too.

Fge
  • 2,971
  • 4
  • 23
  • 37
  • throws "Unable to resolve service "doctrine.entity_manager.orm_default" to a factory; are you certain you provided it during configuration?" – İbrahim Duran Jul 25 '16 at 19:47
  • My lucky guess would be that you're using the V2 ServiceManager while the example used the V3 one. I did put up a rough example a while back: https://github.com/funct/composable-expressive – Fge Jul 25 '16 at 21:38
0

You can try fanst1109/doctrine-orm-module

composer require fanst1109/doctrine-orm-module

It is a Zend Framework 3 Module that provides Doctrine ORM functionality

Al Foиce ѫ
  • 4,195
  • 12
  • 39
  • 49
pedro
  • 447
  • 4
  • 15