ZF2-388: Aliases are not checked for by peering managers
Description
There are a couple of situations possible with peering managers in Zend\ServiceManager:
- Retrieve service from manager and manager uses a peering manager
- 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.'
Comments
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: https://github.com/zendframework/zf2/issues/2497