i want to get the "PublisherId" from my twig file.
it returns me an error ----An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "myBundle_publisher" as such route does not exist.")
I read the twig documentation and there it also write like how i write it.
Do anyone knows how i can solve this problem . Really stack here, can someone solve this problem, thanks in advanced.
The routes need to be imported to be active as any other routing resources (note the annotation type):
# import routes from a controller class
post:
resource: "#SensioBlogBundle/Controller/PostController.php"
type: annotation
More information about #Route
Related
I installed SonataClassificationBundle and extend it on my App\Application folder. The documentation on the official website isn't clear Classification Bundle
I corrected all namespaces to point into my extended bundle. I cleared the cache without error and I run the server.
When I log into the profile, I get this exception :
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "admin_app_sonataclassificationcategory_create" as such route does not exist.").
There is my sonata_classification:
sonata_classification:
class:
category: App\Application\Sonata\ClassificationBundle\Entity\Category
collection: App\Application\Sonata\ClassificationBundle\Entity\Collection
context: App\Application\Sonata\ClassificationBundle\Entity\Context
tag: App\Application\Sonata\ClassificationBundle\Entity\Tag
I detected the same problem with SonataUserBundle, but after promoting my user to ROLE_ADMIN, the problem was solved.
Can someone help?
Thank you
Solved again.
I just run :
composer update
I am following the instructions at https://symfony.com/doc/2.x/bundles/SonataAdminBundle/cookbook/recipe_custom_action.html to build a custom CRUDController in a Symfony/Sonata application.
When I look at the list view, I get the following error message:
An exception has been thrown during the rendering of a template
("Unable to generate a URL for the named route "clone" as such route
does not exist.").
Is there additional code needed in order to get the application to recognize my new route?
Ah -- I had to put my configureRoutes() definition in the admin class rather than the controller class. The documentation was wrong.
I have 7 bundles in my project. So I pointed each from main routing file (app->config->routing.yml).
I have a requirement that same routing file inside a bundle can able to be called using different paths. Like one path with an argument and other without argument.
My main routing file looks like as follows
clubadmin_general:
resource: "#TestGeneralBundle/Resources/config/routing.yml"
host: "mywebsite"
prefix: /{url_identifier}/admin/
clubadmin_general_club_domain:
resource: "#TestGeneralBundle/Resources/config/routing.yml"
prefix: /admin/
The routing file inside the bundle is common when called form main routing file. The routing file inside the bundle is looks like..
show_dashboard:
pattern: /
defaults: { _controller: TestGeneralBundle:Dashboard:index }
When I called, routing defined first gives "No route found". But the second works well. When I changed the order, always second works well.
In the above code path "/admin/" works well. But path "/{url_identifier}/admin/" will not work.
I think "show_dashboard" name is cached for a route. May be that is the issue. But couldn't find a solution.
Someone please help me.
Finally found a solution... By create different environment, the cache folder get separated and then can able to use same routing names with different paths.
I'm having trouble finding the correct tutorial for me. I'm trying to have a controller-configuration in my bundle in Resources/config/someconfig.yml. I already adjusted it to a .yml extension. Now I'm searching a solution to access this configuration inside a twig exception controller (404-pages) and merge this configuration with the config.yml in app/config/.
Can anybody help me with a tutorial link or tips?
Thank you!
To get Resources/config/someconfig.yml config you can create DI extension: http://symfony.com/doc/current/cookbook/bundles/extension.html
I think this can help you to get configuration value in view: How to get config parameters in Symfony2 Twig Templates
As an alternative you can override Exception controller (get configuration parameters there and pass them to the view): http://symfony.com/doc/current/cookbook/controller/error_pages.html#replace-the-default-exception-controller
For merging configurations among independent bundles you should use prependExtensionConfig method and PrependExtensionInterface interface.
Documentaion page How to Simplify Configuration of multiple Bundles explains this technique in great detail.
I need to include href to profile/edit in my view. Template engine is twig, so code look like this:
Edit profile
But i get exception:
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "fos_user_profile" as such route does not exist.") in VputiUserBundle:ProfileShow:show.html.twig at line 4.
Please help, where is mistake?
First, debug your router
$ php app/console router:debug --env=[env]
And use the correct environment
If the route shows up, then you probably need to clear the cache
$ php app/console cache:clear --env=[env]
If the route doesn't show up, then whatever bundle that provides that route isn't being loaded correctly.
Also, if you're using a front-controller with debugging turned on, you can check the web debug toolbar.
The message tells it all. Route with name fos_user_profile does not exist.
I guess this route name comes from FOSUserBundle, so check that VputiUserBundle extends it properly.
The path('fos_user_profile') does not exist. It routes to #FOSUserBundle/Resources/config/routing/profile.xml. There you can find the actual usable routes, like:
Edit profile