Closed maxnuf closed 2 years ago
Yep. Aliases are not supported by DoctrineModule. If you do need to use an alias, you need to create an extra factory to resolve it manually, like this: https://github.com/doctrine/DoctrineORMModule/blob/master/src/DoctrineORMModule/Service/EntityManagerAliasCompatFactory.php
That seems a bit cumbersome. Also, the factory your pointing to is deprecated. So is it really the preferred solution?
Atleast you're right, aliasing Doctrine\ORM\EntityManager
solves my problem.
I agree it's a bit cumbersome, but it's the best compromise at the moment. We're still in the process of working out some new service naming conventions for doctrineModule
. See discussion in #233.
Regarding depreciation, I think it's to indicate that this is a temporary thing to help give those who may be using the old alias to change over. @Ocramius will be able to give you a definitive answer.
Yes, I marked the factory as deprecated because it's a hack... On 15 May 2013 01:59, "Tim Roediger" notifications@github.com wrote:
I agree it's a bit cumbersome, but it's the best compromise at the moment. We're still in the process of working out some new service naming conventions for doctrineModule. See discussion in #233https://github.com/doctrine/DoctrineModule/issues/233 .
Regarding depreciation, I think it's to indicate that this is a temporary thing to help give those who may be using the old alias to change over. @Ocramius https://github.com/Ocramius will be able to give you a definitive answer.
— Reply to this email directly or view it on GitHubhttps://github.com/doctrine/DoctrineModule/issues/246#issuecomment-17912927 .
Thanks, I understand.
I'm seeing an issue when trying to use GoalioRememberMeDoctrineORM It has aliased the
doctrine.entitymanager.orm_default
tozfcuser_doctrine_em
(actually this happens in ZfcUserDoctrineORM, but that is not relevant)When it tries to get this instance from the servicmanager I receive a service not found exception.
From what I can figure out: when calling
$sm->get('zfcuser_doctrine_em');
it will callcanCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
inAbstractDoctrineServiceFactory
with$name = 'doctrine.entitymanager.ormdefault'
(note the missing underscore) and$requestedName = 'zfcuser_doctrine_em'
both of which cannot be resolved by the
AbstractDoctrineServiceFactory
.