-
Notifications
You must be signed in to change notification settings - Fork 24
Zend\Navigation does not work with Zend\Expressive #56
Description
I want to use Zend\Navigation in a Zend\Expressive application. First of all, I installed it:
composer require zendframework/zend-navigation
Composer installed it and added the ConfigProvider to my /config/config.php file:
$configManager = new ConfigManager(
[
Zend\I18n\ConfigProvider::class,
Zend\Form\ConfigProvider::class,
Zend\InputFilter\ConfigProvider::class,
Zend\Hydrator\ConfigProvider::class,
Zend\Session\ConfigProvider::class,
TravelloViewHelper\ConfigProvider::class,
new PhpFileProvider($pattern),
],
$cachedConfigFile
);
When I try to use the navigation view helper in a template, I get this error:
A plugin by the name "navigation" was not found in the plugin manager Zend\View\HelperPluginManager
So, I added the Zend\Navigation\View\ViewHelperManagerDelegatorFactory to my configuration:
return [
'dependencies' => [
'delegators' => [
Zend\View\HelperPluginManager::class => [
Zend\Navigation\View\ViewHelperManagerDelegatorFactory::class,
],
],
],
];
No I get this error:
Unable to resolve service "Application" to a factory; are you certain you provided it during configuration?
After some investigation the problem is located here:
The AbstractNavigationFactory seems to have a hard dependency on the MVC application which makes it impossible to use Zend\Navigation with Zend\Expressive currently.
Are there any plans to solve this? What should be done to break up this hard dependency? I guess it would be quite complicated to run Zend\Navigation both with Zend\Mvc and Zend\Expressive, wouldn't it?