Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZF3 Navigation "plugin" error

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
like image 466
user2501247 Avatar asked Jan 05 '23 16:01

user2501247


2 Answers

Running

composer require zendframework/zend-navigation

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

like image 85
Ponsjuh Avatar answered Jan 08 '23 05:01

Ponsjuh


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

like image 24
Nico M Avatar answered Jan 08 '23 05:01

Nico M