4

Following https://docs.zendframework.com/zend-navigation/quick-start/, i try to make a navigation for my application. I registered a navigation, i added the DefaultNavigationFactory to the service-manager, but i get an error when i try to print the navigation.

This is my module/Application/config/module.config.php:

namespace Application;

use Zend\Navigation\Service\DefaultNavigationFactory;
use Zend\ServiceManager\Factory\InvokableFactory;
use Zend\View\Helper\Navigation;

return [
'navigation' => [
    'default' => [
        /* ... */
    ]
] ,

'service_manager' => [
    'factories' => [
        'navigation' => DefaultNavigationFactory::class,
    ],
],
];

But when $this->navigation('default')->menu(), i get this error, excluding the stack trace:

Fatal error: Uncaught Zend\ServiceManager\Exception\ServiceNotFoundException: A plugin by the name "navigation" was not found in the plugin manager Zend\View\HelperPluginManager in C:\Users\bikke_000\Documents\Sites\slapenenzo\vendor\zendframework\zend-servicemanager\src\AbstractPluginManager.php:133
edigu
  • 9,878
  • 5
  • 57
  • 80
user2501247
  • 109
  • 8

4 Answers4

4

Running

composer require zendframework/zend-navigation

fixed the issue it seems that in zf3 navigation isn't installed by default

Ponsjuh
  • 468
  • 3
  • 13
3

In addition to the answer of @Ponsjuh I had to include the module "Zend\Navigation" in my modules config.

NiMeDia
  • 995
  • 1
  • 15
  • 27
1

you need to pass 'navigation' instead of 'default' as below:

 $this->navigation('navigation')->menu();
Azhar Ahmad
  • 183
  • 12
1

Check your "development mode". In production mode, 'config_cache_enabled' is true. When you install new module, you must refresh cache. Default: 'data/cache/module-config-cache.application.config.cache.php'

macieklag
  • 11
  • 2