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


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:

'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()):

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.'


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