Hy everybody!
I am learning zf2, and trying to set up a navigation panel(based on: Zend Framework 2: Zend_Navigation), but the answer from the computer is still:
An error occurred An error occurred during execution; please try again later. Additional information: Zend\ServiceManager\Exception\ServiceNotFoundException File: /var/www/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:453 Message: Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for navigation
The module.config.php contain:
'servicemanager' => array(
'factories' => array(
'navigation' => function($sm) {
$config = $sm->get('Config');
$navigation = new \Zend\Navigation\Navigation($config->get('navigation'));
return $navigation;
}
),
),
I have an application.global.php in the main config/autoload folder which is looks like:
<?php
return array(
// All navigation-related configuration is collected in the 'navigation' key
'navigation' => array(
// The DefaultNavigationFactory we configured in (1) uses 'default' as the sitemap key
'default' => array(
// And finally, here is where we define our page hierarchy
'Album' => array(
'label' => 'Albumlista',
'route' => 'album',
'action' => 'index',
'pages' => array(
array(
'label' => 'Add',
'route' => 'album',
'action' => 'add'
)
)
),
'Application' => array(
'label' => 'Alap alkalmazás',
'route' => 'application',
'action' => 'index',
)
),
),
);
And from the controller i give this command:
$config = $this->getServiceLocator()->get('navigation');
Could somebody help me to solve this problem? I read about http://adam.lundrigan.ca/2012/07/quick-and-dirty-zf2-zend-navigation/ , I tried it, and I did it, but I would like to combine with acl so that I wrote this question.
Thanks for every help!