Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Ensure Navigation helper PluginManager is BC #47

Conversation

weierophinney
Copy link
Member

Adds tests similar to those for the HelperPluginManager to ensure that the first argument to the Navigation\PluginManager is optional and/or accepts a Zend\ServiceManager\Config instance, and updates the constructor to work with both v2 and v3.

Fixes zendframework/zend-navigation#19 and zenframework/zend-view#45

Adds tests similar to those for the `HelperPluginManager` to ensure that
the first argument to the `Navigation\PluginManager` is optional and/or
accepts a `Zend\ServiceManager\Config` instance, and updates the
constructor to work with both v2 and v3.
Implements a full compatibility test for the navigation plugin manager.
@weierophinney
Copy link
Member Author

Most recent changes also address the alias resolution reported in #46.

@weierophinney
Copy link
Member Author

In a private email, @webimpress has indicated that the initializers registered by HelperPluginManager are not receiving a container instance; I'm going to investigate that before merging.

@weierophinney
Copy link
Member Author

Okay, what I've discovered is that Zend\View\Helper\Navigation lazy-loads Zend\View\Helper\Navigation\PluginManager by default. This means that it doesn't have a parent service manager instance, which in turn means that the initializers it registers due to inheriting from Zend\View\HelperPluginManager do not have a parent locator instance, and thus cannot be injected with things like the translator.

Under v2, this worked because of this line:

which essentially made it so that the navigation plugins, even if translator-aware, are never injected with a translator.

I'll re-instate that behavior for now, and later, when preparing zend-navigation for forwards-compatibility, I'll set it up to create a navigation plugin manager that's injected with the parent locator of the helper plugin manager.

Adds a test for a condition reported by @webimpress, detailing expected
behavior if the plugin manager does not have a parent locator when
`injectTranslator()` is called (should return null, not error), and adds
a conditional into `injectTranslator()` to return early if no container
is available.
... when testing against zend-servicemanager v3.
@weierophinney weierophinney removed the WIP label Feb 18, 2016
@weierophinney weierophinney merged commit 8c45bed into zendframework:master Feb 18, 2016
weierophinney added a commit that referenced this pull request Feb 18, 2016
weierophinney added a commit that referenced this pull request Feb 18, 2016
weierophinney added a commit that referenced this pull request Feb 18, 2016
@weierophinney weierophinney deleted the hotfix/navigation-plugin-manager branch February 18, 2016 16:46
@froschdesign
Copy link
Member

Looks good!

@gianarb
Copy link
Contributor

gianarb commented Feb 18, 2016

Good 👍 2.6.2 works fine for me.. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants