ZF-Commons / ZfcUserDoctrineORM

Doctrine2 ORM storage adapter for ZfcUser.
BSD 3-Clause "New" or "Revised" License
89 stars 92 forks source link

zfcuser_doctrine_em service is not available any more #54

Closed thestanislav closed 10 years ago

thestanislav commented 11 years ago

zfcuser_doctrine_em service, alias of doctrine.entitymanager.orm_default is not available after recent service creation refactor of DoctrineModule

Ocramius commented 11 years ago

Workaround for now:

`zfcuser_doctrine_em` => function ($sl) { return $sl->get('doctrine.entitymanager.orm_default'); }

Please give it a try and let me know.

Ocramius commented 11 years ago

Aliasing Doctrine\ORM\EntityManager should also work

UBy commented 11 years ago

I see two suggestions for solving this problem, but I have no idea on how to proceed. Where (in what files) can I try these solutions? in zfcuser.global.php (tried that) or some other file. Alternatively does someone know what versions (of this module and zfcUser) to use to avoid the updated Doctrine module?

Ocramius commented 11 years ago

@UBy use 0.7 of the doctrine modules, which are STABLE.

If you use master, you'll always get into such problems

UBy commented 11 years ago

@Ocramius - Thanks that solved my problem.

thestanislav commented 11 years ago

Any updates?

Ocramius commented 11 years ago

The aliased service should be Doctrine\ORM\EntityManager. Once the alias is changed, this should work again.

jaroslavas commented 10 years ago

Some info for newbies. Open file module/Application/config/module.config.php and find key service_manager->aiases. Add 'zfcuser_doctrine_em' => 'Doctrine\ORM\EntityManager'. Mine looks like this:

'service_manager' => array(
        'abstract_factories' => array(
            'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
            'Zend\Log\LoggerAbstractServiceFactory',
        ),
        'aliases' => array(
            'translator' => 'MvcTranslator',
            'zfcuser_doctrine_em' => 'Doctrine\ORM\EntityManager', // Line added to fix this issue
        ),
        'factories' => array(
                'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory',
        ),
    ),
finbarrmccarthy commented 10 years ago

Thanks @jaroslavas - This did the trick

lukeocodes commented 10 years ago

@jaroslavas Thank you very much!

My module/Application/config/module.config.php ended up looking like this with ZF2 2.2 fresh install (after following the skeleton tutorial).

...
  'service_manager' => array(
    'factories' => array(
      'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
      'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory',
    ),
    'aliases' => array(
      'zfcuser_doctrine_em' => 'Doctrine\ORM\EntityManager', // added to fix dodgy ZfcUser/Doctrine integration
    ),
  ),
...
Danielss89 commented 10 years ago

fixed in #69