Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Invalid instantiator of type "NULL" for "Zend\I18n\Translator\TranslatorInterface" #6022

Closed
spalax opened this issue Mar 21, 2014 · 1 comment

Comments

@spalax
Copy link
Contributor

spalax commented Mar 21, 2014

I have a little trouble, it is appears because of:

Zend\Mvc\Service\TranslatorServiceFactory line 33

if ($serviceLocator->has('Zend\I18n\Translator\TranslatorInterface')) {
     return new MvcTranslator($serviceLocator->get('Zend\I18n\Translator\TranslatorInterface'));
}

I use DI in my application, and this is cause very interesting error

Zend\ServiceManager\Exception\ServiceNotCreatedException: An exception was raised while creating "MvcTranslator"; no instance returned

when i had investigated this issue i found behaviour which in my opinion is not logical, but maybe i do not understand something.

What the reason

DiAbstractServiceFactory::canCreateServiceWithName(...Zend\I18n\Translator\TranslatorInterface..) 

returns true, but

DiAbstractServiceFactory::createServiceWithName(...Zend\I18n\Translator\TranslatorInterface..) 

fails with exception ? I guess it is not predictable.

Second part:
In this commit 175b4b7
lines:

if ($serviceLocator->has('Zend\I18n\Translator\TranslatorInterface')) {
     return new MvcTranslator($serviceLocator->get('Zend\I18n\Translator\TranslatorInterface'));
}

this is force me to add 'Zend\I18n\Translator\TranslatorInterface' as shared Instance to the DI instanceManager but i think it is not a good decision.

Did i miss something ?

@Ocramius
Copy link
Member

Duplicate of #5959

@Ocramius Ocramius self-assigned this Mar 21, 2014
@Ocramius Ocramius added this to the 2.3.1 milestone Apr 3, 2014
Ocramius added a commit that referenced this issue Apr 3, 2014
Ocramius added a commit that referenced this issue Apr 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants