sonata-project / SonataPageBundle

This bundle provides a Site and Page management through container and block services
https://docs.sonata-project.org/projects/SonataPageBundle
MIT License
216 stars 209 forks source link

Problem with a transversal page and the sidebar menu on the edition page #212

Closed barduck007 closed 11 years ago

barduck007 commented 11 years ago

I have a problem in the admin interface when I try to go on the Edit Page of a transversal page that I have created. Indeed, the following exception appears: An exception has been thrown during the rendering of a template ("Please provide a path parameters") in "SonataAdminBundle:CRUD:edit.html.twig".

I found that the problem is in the function "Sonata\PageBundle\Admin\PageAdmin::configureSideMenu()" at the line 249, when the process try to get the URL of the transversal page. At this moment, my page doesn't have an URL setted.

Can you help me to understand what the problem is?

Thanks !

rande commented 11 years ago

I guess the exception is not enough M

            try {
                $menu->addChild(
                    $this->trans('view_page'),
                    array('uri' => $this->getRouteGenerator()->generate('page_slug', array('path' => $this->getSubject()->getUrl())))
                );
            } catch (RouteNotFoundException $e) {
                // avoid crashing the admin if the route is not setup correctly
//                throw $e;
            }

Can you provide the exception type ?

barduck007 commented 11 years ago

Hello @rande and thanks for your quick response !

The exception type is Runtime exception.

It's throwed by the function "\Sonata\PageBundle\Route\CmsPageRouter::generateFromPageSlug()".

Thanks again for your help!

Regards

rande commented 11 years ago

@barduck007 can you create a PR to change RouteNotFoundException => Exception ? thanks

barduck007 commented 11 years ago

@rande I did the PR. Can you check if it's ok for you?

Thanks for your help.

rande commented 11 years ago

merged