Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ConstructedNavigationFactory does not inject components #2898

juriansluiman opened this Issue Nov 6, 2012 · 0 comments


None yet
1 participant

juriansluiman commented Nov 6, 2012

The ConstructedNavigationFactory is not tested and does not work as it is intended as what I see from the code.

The use case as far as I understand is this:

use Zend\Navigation\Service\ConstructedNavigationFactory;

class MyController extends AbstractActionController

  public function indexAction()
    $config = array(
      // your config here

    $factory    = new ConstructedNavigationFactory($config);
    $navigation = $factory->createService($this->getServiceLocator());

    return new ViewModel(array(
        'navigation' => $navigation;

So you can create a navigation object with the factory where the factory handles the dependencies. The AbstractNavigationFactory::injectComponents() is called inside AbstractNavigationFactory::getPages and the ConstructedNavigationFactory overrides this method: https://github.com/zendframework/zf2/blob/master/library/Zend/Navigation/Service/ConstructedNavigationFactory.php#L35

Looking into the tests, the default factory and constructed factory are not tested, this behaviour is as far as I see intended but not working at all.

weierophinney added a commit that referenced this issue Mar 28, 2013

gianarb pushed a commit to zendframework/zend-navigation that referenced this issue May 15, 2015

weierophinney added a commit to zendframework/zend-navigation that referenced this issue May 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment