2.2.6 -> 2.3.0 causes DI to try to instantiate `Zend\I18n\Translator\TranslatorInterface` instead of `Zend\I18n\Translator\Translator` #6051

Closed
TwoWholeWorms opened this Issue Mar 27, 2014 · 2 comments

2 participants

@TwoWholeWorms

Unfortunately, I can't work out why exactly this is happening, but the I18n module worked fine prior to upgrading from ZF2 2.2.6 to 2.3.0.

I have this in module/Application/config/module.config.php

'service_manager' => [
    'aliases' => [
        'translator' => 'MvcTranslator',
    ],
],

and this in each module's module.config.php

'translator' => [
    'translation_file_patterns' => [
        [
            'type'     => 'gettext',
            'base_dir' => __DIR__ . '/../language',
            'pattern'  => '%s.mo',
        ],
    ],
],

The only DI configuration I have so far is this:

'di' => [
    'instance' => [
        'Zend\View\HelperLoader' => [
            'parameters' => [
            'map' => [
                    'zfcUserIdentity' => 'ZfcUser\View\Helper\ZfcUserIdentity',
                    'zfcUserLoginWidget' => 'ZfcUser\View\Helper\ZfcUserLoginWidget',
                ],
            ],
        ],
    ],
],

Does 2.3.0 add a requirement to add additional configuration to the DI block in order for I18n to work properly? This isn't reflected in the documentation and I haven't been able to work it out from reading the code so far, but from the exceptions below it looks like it's actually trying to create an instance of Zend\I18n\Translator\TranslatorInterface itself rather than Zend\I18n\Translator\Translator as it did previously?

The Exception history is as follows:

Zend\Di\Exception\RuntimeException: Invalid instantiator of type "NULL" for "Zend\I18n\Translator\TranslatorInterface". in /path/to/vendor/zendframework/zendframework/library/Zend/Di/Di.php on line 305
Zend\ServiceManager\Exception\ServiceNotCreatedException: An exception was raised while creating "Zend\I18n\Translator\TranslatorInterface"; no instance returned in /path/to/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 909
Zend\ServiceManager\Exception\ServiceNotCreatedException: An abstract factory could not create an instance of zendi18ntranslatortranslatorinterface(alias: Zend\I18n\Translator\TranslatorInterface). in /path/to/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 1070
Zend\ServiceManager\Exception\ServiceNotCreatedException: An exception was raised while creating "MvcTranslator"; no instance returned in /path/to/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 909
@Ocramius
Zend Framework member

Duplicate of #5959

@Ocramius Ocramius closed this Mar 27, 2014
@Ocramius Ocramius self-assigned this Mar 27, 2014
@TwoWholeWorms

I suspected this had been reported before. Cheers.

@Ocramius Ocramius added this to the 2.3.1 milestone Apr 3, 2014
@Ocramius Ocramius added a commit that referenced this issue Apr 3, 2014
@Ocramius Ocramius Merge branch 'hotfix/#5959-#6022-#6051-di-abstract-factory-without-in…
…stantiators-fallback'

Close #5959 #6022 #6051
eeb9267
@Ocramius Ocramius added a commit that referenced this issue Apr 3, 2014
@Ocramius Ocramius Merge branch 'hotfix/#5959-#6022-#6051-di-abstract-factory-without-in…
…stantiators-fallback' into develop

Close #5959 #6022 #6051
Forward Port #5959 #6022 #6051
13356c3
@gianarb gianarb pushed a commit to zendframework/zend-servicemanager that referenced this issue May 15, 2015
@Ocramius Ocramius Merge branch 'hotfix/zendframework/zf2#5959-zendframework/zf2#6022-ze…
…ndframework/zf2#6051-di-abstract-factory-without-instantiators-fallback'

Close zendframework/zendframework#5959 zendframework/zendframework#6022 zendframework/zendframework#6051
698e4c9
@gianarb gianarb pushed a commit to zendframework/zend-servicemanager that referenced this issue May 15, 2015
@Ocramius Ocramius Merge branch 'hotfix/zendframework/zf2#5959-zendframework/zf2#6022-ze… bf87264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment