ZF2-388: Aliases are not checked for by peering managers

Issue Type: Bug Created: 2012-07-08T12:48:48.000+0000 Last Updated: 2012-10-08T20:15:10.000+0000 Status: Closed Fix version(s): Reporter: Jurian Sluiman (mithras) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\ServiceManager

Related issues: Attachments:


There are a couple of situations possible with peering managers in Zend\ServiceManager:

  1. Retrieve service from manager and manager uses a peering manager
  2. Set an alias and retrieve a service by the alias and the manager uses the original name

However, a cross-situation is not possible: set an alias in one manager, use a peering manager for the factory of the alias value. If I provide a view helper alias in a module configuration (the array returned from Module::getConfig()) like this:

<pre class="highlight">
'view_helpers' => array(
    'aliases' => array(
        'foo' => 'My\View\Helper\Foo',

And I set a factory in the common service manager (the array returned from Module::getServiceConfiguration()):

<pre class="highlight">
use My\View\Helper as ViewHelper;

return array(
    'factories' => array(
        'My\View\Helper\Foo' => function ($sm) {
            $helper = new ViewHelper\Foo;
            return $helper;

And in a view template I use ```` I get an error from the service manager:

bq. Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'An alias "foo" was requested but no service could be found.'


Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:10.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.