Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to add laminas-navigation to a basic mezzio skeleton application #33

Closed
alexlanni opened this issue Mar 20, 2022 · 4 comments
Closed
Labels
Bug Something isn't working Documentation Needed Documentation Duplicate This issue or pull request already exists

Comments

@alexlanni
Copy link

Bug Report

Q A
Version(s) 2.13.x

Summary

Starting from a fresh installation of Mezzio skeleton application, it seems there is no way to make laminas navigation View Helper plugin works.

Current behavior

Following the installation instructions on a Mezzio skeleton application, this error comes up:

Laminas\ServiceManager\Exception\ServiceNotFoundException thrown with message "A plugin by the name "navigation" was not found in the plugin manager Laminas\View\HelperPluginManager"

Stacktrace:
#41 Laminas\ServiceManager\Exception\ServiceNotFoundException in /var/www/vendor/laminas/laminas-servicemanager/src/AbstractPluginManager.php:166
#40 Laminas\ServiceManager\AbstractPluginManager:get in /var/www/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php:370
#39 Laminas\View\Renderer\PhpRenderer:plugin in /var/www/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php:388
#38 Laminas\View\Renderer\PhpRenderer:__call in /var/www/src/App/templates/layout/default.phtml:29
#37 include in /var/www/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php:500
#36 Laminas\View\Renderer\PhpRenderer:render in /var/www/vendor/mezzio/mezzio-laminasviewrenderer/src/LaminasViewRenderer.php:226
#35 Mezzio\LaminasView\LaminasViewRenderer:renderModel in /var/www/vendor/mezzio/mezzio-laminasviewrenderer/src/LaminasViewRenderer.php:132
#34 Mezzio\LaminasView\LaminasViewRenderer:render in /var/www/src/App/src/Handler/HomePageHandler.php:98
#33 App\Handler\HomePageHandler:handle in /var/www/vendor/laminas/laminas-stratigility/src/Middleware/RequestHandlerMiddleware.php:46
#32 Laminas\Stratigility\Middleware\RequestHandlerMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#31 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/mezzio/mezzio-router/src/Route.php:85
#30 Mezzio\Router\Route:process in /var/www/vendor/mezzio/mezzio-router/src/RouteResult.php:97
#29 Mezzio\Router\RouteResult:process in /var/www/vendor/mezzio/mezzio-router/src/Middleware/DispatchMiddleware.php:30
#28 Mezzio\Router\Middleware\DispatchMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#27 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#26 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-helpers/src/UrlHelperMiddleware.php:42
#25 Mezzio\Helper\UrlHelperMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#24 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#23 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/MethodNotAllowedMiddleware.php:56
#22 Mezzio\Router\Middleware\MethodNotAllowedMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#21 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#20 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/ImplicitOptionsMiddleware.php:72
#19 Mezzio\Router\Middleware\ImplicitOptionsMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#18 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#17 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/ImplicitHeadMiddleware.php:76
#16 Mezzio\Router\Middleware\ImplicitHeadMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#15 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#14 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/RouteMiddleware.php:50
#13 Mezzio\Router\Middleware\RouteMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#12 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#11 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-helpers/src/ServerUrlMiddleware.php:30
#10 Mezzio\Helper\ServerUrlMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#9 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#8 Laminas\Stratigility\Next:handle in /var/www/vendor/laminas/laminas-stratigility/src/Middleware/ErrorHandler.php:131
#7 Laminas\Stratigility\Middleware\ErrorHandler:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#6 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#5 Laminas\Stratigility\Next:handle in /var/www/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:76
#4 Laminas\Stratigility\MiddlewarePipe:process in /var/www/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:65
#3 Laminas\Stratigility\MiddlewarePipe:handle in /var/www/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php:82
#2 Laminas\HttpHandlerRunner\RequestHandlerRunner:run in /var/www/vendor/mezzio/mezzio/src/Application.php:68
#1 Mezzio\Application:run in /var/www/public/index.php:29
#0 {closure} in /var/www/public/index.php:30

How to reproduce

Starts installing the Mezzio skeleton application. Choose laminas-view, laminas-router and laminas-service-manager.

Follow the installation instruction of laminas-navigation.
Add some navigation items in mezzio.global.php file.

Expected behavior

The navigation() plugin should be usable in the layout.

@alexlanni alexlanni added the Bug Something isn't working label Mar 20, 2022
@Xerkus
Copy link
Member

Xerkus commented Mar 20, 2022

Most likely it is due to view helper manager key in container not matching.

'ViewHelperManager' => [

Try to add a copy of delegator configuration with \Laminas\View\HelperPluginManager::class as a key.

@alexlanni
Copy link
Author

Hi @Xerkus ,
Thanks for reply.

After that modification I can see Navigation works, but another issue comes up:

Laminas\ServiceManager\Exception\ServiceNotFoundException thrown with message "Unable to resolve service "Application" to a factory; are you certain you provided it during configuration?"

Stacktrace:
#52 Laminas\ServiceManager\Exception\ServiceNotFoundException in /var/www/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:557
#51 Laminas\ServiceManager\ServiceManager:getFactory in /var/www/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:612
#50 Laminas\ServiceManager\ServiceManager:doCreate in /var/www/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:234
#49 Laminas\ServiceManager\ServiceManager:get in /var/www/vendor/laminas/laminas-navigation/src/Service/AbstractNavigationFactory.php:96
#48 Laminas\Navigation\Service\AbstractNavigationFactory:preparePages in /var/www/vendor/laminas/laminas-navigation/src/Service/ConstructedNavigationFactory.php:32
#47 Laminas\Navigation\Service\ConstructedNavigationFactory:getPages in /var/www/vendor/laminas/laminas-navigation/src/Service/AbstractNavigationFactory.php:45
#46 Laminas\Navigation\Service\AbstractNavigationFactory:__invoke in /var/www/vendor/laminas/laminas-navigation/src/Service/NavigationAbstractServiceFactory.php:88
#45 Laminas\Navigation\Service\NavigationAbstractServiceFactory:__invoke in /var/www/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:613
#44 Laminas\ServiceManager\ServiceManager:doCreate in /var/www/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:234
#43 Laminas\ServiceManager\ServiceManager:get in /var/www/vendor/laminas/laminas-view/src/Helper/Navigation/AbstractHelper.php:266
#42 Laminas\View\Helper\Navigation\AbstractHelper:parseContainer in /var/www/vendor/laminas/laminas-view/src/Helper/Navigation/AbstractHelper.php:538
#41 Laminas\View\Helper\Navigation\AbstractHelper:setContainer in /var/www/vendor/laminas/laminas-view/src/Helper/Navigation.php:77
#40 Laminas\View\Helper\Navigation:__invoke in /var/www/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php:391
#39 call_user_func_array in /var/www/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php:391
#38 Laminas\View\Renderer\PhpRenderer:__call in /var/www/src/App/templates/layout/default.phtml:29
#37 include in /var/www/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php:500
#36 Laminas\View\Renderer\PhpRenderer:render in /var/www/vendor/mezzio/mezzio-laminasviewrenderer/src/LaminasViewRenderer.php:226
#35 Mezzio\LaminasView\LaminasViewRenderer:renderModel in /var/www/vendor/mezzio/mezzio-laminasviewrenderer/src/LaminasViewRenderer.php:132
#34 Mezzio\LaminasView\LaminasViewRenderer:render in /var/www/src/App/src/Handler/HomePageHandler.php:98
#33 App\Handler\HomePageHandler:handle in /var/www/vendor/laminas/laminas-stratigility/src/Middleware/RequestHandlerMiddleware.php:46
#32 Laminas\Stratigility\Middleware\RequestHandlerMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#31 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/mezzio/mezzio-router/src/Route.php:85
#30 Mezzio\Router\Route:process in /var/www/vendor/mezzio/mezzio-router/src/RouteResult.php:97
#29 Mezzio\Router\RouteResult:process in /var/www/vendor/mezzio/mezzio-router/src/Middleware/DispatchMiddleware.php:30
#28 Mezzio\Router\Middleware\DispatchMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#27 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#26 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-helpers/src/UrlHelperMiddleware.php:42
#25 Mezzio\Helper\UrlHelperMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#24 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#23 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/MethodNotAllowedMiddleware.php:56
#22 Mezzio\Router\Middleware\MethodNotAllowedMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#21 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#20 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/ImplicitOptionsMiddleware.php:72
#19 Mezzio\Router\Middleware\ImplicitOptionsMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#18 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#17 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/ImplicitHeadMiddleware.php:76
#16 Mezzio\Router\Middleware\ImplicitHeadMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#15 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#14 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-router/src/Middleware/RouteMiddleware.php:50
#13 Mezzio\Router\Middleware\RouteMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#12 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#11 Laminas\Stratigility\Next:handle in /var/www/vendor/mezzio/mezzio-helpers/src/ServerUrlMiddleware.php:30
#10 Mezzio\Helper\ServerUrlMiddleware:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#9 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#8 Laminas\Stratigility\Next:handle in /var/www/vendor/laminas/laminas-stratigility/src/Middleware/ErrorHandler.php:131
#7 Laminas\Stratigility\Middleware\ErrorHandler:process in /var/www/vendor/mezzio/mezzio/src/Middleware/LazyLoadingMiddleware.php:37
#6 Mezzio\Middleware\LazyLoadingMiddleware:process in /var/www/vendor/laminas/laminas-stratigility/src/Next.php:51
#5 Laminas\Stratigility\Next:handle in /var/www/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:76
#4 Laminas\Stratigility\MiddlewarePipe:process in /var/www/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:65
#3 Laminas\Stratigility\MiddlewarePipe:handle in /var/www/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php:82
#2 Laminas\HttpHandlerRunner\RequestHandlerRunner:run in /var/www/vendor/mezzio/mezzio/src/Application.php:68
#1 Mezzio\Application:run in /var/www/public/index.php:29
#0 {closure} in /var/www/public/index.php:30

It seems that in the preparePages method of AbstractNavigationFactory there is a reference to the Laminas Application. Needs to find a custom way to adapt it.

Thanks again

@Xerkus
Copy link
Member

Xerkus commented Mar 20, 2022

I checked the code and there is no support for Mezzio. Factories are MVC specific and component itself uses Laminas\Http.

Documentation uses installation page template that implies support for Mezzio, which is wrong.

@Xerkus Xerkus added Documentation Documentation Needed Duplicate This issue or pull request already exists labels Mar 20, 2022
@Xerkus
Copy link
Member

Xerkus commented Mar 20, 2022

Going to close this as a duplicate of #2

@Xerkus Xerkus closed this as completed Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Documentation Needed Documentation Duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants