ZF2-351: Factories name and plugin name

Issue Type: Bug Created: 2012-06-08T20:37:46.000+0000 Last Updated: 2012-08-11T10:16:05.000+0000 Status: Resolved Fix version(s): Reporter: BLANCHON Vincent (blanchon_vincent) Assignee: Maks 3w (maks3w) Tags: - Zend\Loader

Related issues: Attachments:


I defined factory in Application\Module :

<pre class="highlight">
public function getServiceConfiguration()
        return array(
            'factories' => array(
                'Navigation' => 'ZFBook\Navigation\Service\NavigationFactory',

But, in my view, when i write :

<pre class="highlight">
echo $this->navigation()->breadcrumbs()->setMinDepth(0)->setLinkLast(true)->setPartial('bloc/breadcrumbs')->render();

Plugin name 'navigation' don't call the view helper, but my factory. Because in Zend\Loader\PluginBroker :

<pre class="highlight">
$locator  = $this->getServiceLocator();
        // Pulling by alias
        if ($locator) {
            try {
                $instance = $locator->get($plugin);
            } catch (ServiceManagerException $e) {
                // not returning an instance is okay; there are other ways to 
                // retrieve the plugin later
                $instance = false;

            if ($instance) {
                if ($this->getRegisterPluginsOnLoad()) {
                    $this->register($pluginName, $instance);
                return $instance;

        $class = $this->getClassLoader()->load($plugin);
        if (empty($class) && !class_exists($plugin)) {
            throw new Exception\RuntimeException('Unable to locate class associated with "' . $pluginName . '"');

        if (empty($class) && class_exists($plugin)) {
            $class = $plugin;

I think, we must resolved the short name in first, and try with service manager in second, no ?


Posted by Matthew Weier O'Phinney (matthew) on 2012-06-12T13:40:59.000+0000


Or, rather, we're trying to figure out what to do here.

The SM duplicates a lot of functionality present in the Plugin Broker/Loader ecosystem: aliasing, instance creation and management, initialization checks, etc. In some ways, it may make sense to simply replace the broker/loader system with context-specific SMs (scoped containers, basically). For now, one of the easiest ways to handle a plugin that has dependencies is to simply add a factory to the SM using the same service name as the plugin name -- this solves a long-standing problem we've had with plugins like the Url plugin, the basePath plugin, navigation plugin, etc.

I'll leave this open for now, as what you're seeing is definitely a "WTF" type of issue; however, we should resolve this in time for beta5 to remove any problems like this that arise.

Posted by Maks 3w (maks3w) on 2012-08-11T10:12:22.000+0000

Zend\Loader\PluginBroker not longer exists in RC versions of ZF2. Is it still happening?

Posted by Maks 3w (maks3w) on 2012-08-11T10:14:44.000+0000

By the moment I'll close this issue. Feel free to reopen it if ServiceManager ZF2 RC versions don't fix your issue.

Posted by BLANCHON Vincent (blanchon_vincent) on 2012-08-11T10:16:05.000+0000

No, problem resolved with new plugin manager

Have you found an issue?

See the Overview section for more details.


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

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