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.
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 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
I've created a copy(right-click Copy & Paste) of my Home page in a VS2013 ASP.NET MVC5 project and named it indexL10. When I try to run it, I get the following error:
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.
Requested URL: /Home/IndexL10
So, I'm guessing there's more to it than copying and pasting. I've tried googling around, but I've not found an answer, or search string that takes me to a page of a user with a similar problem.
Does anyone have any ideas/suggestions? Thanks
*.cshtml files are not like *.aspx files. They're not directly exposed. The URL is translated by the framework into a route. That route points to a particular controller and a particular action in that controller, which is then called by the framework. The action returns an ActionResult, which in MVC is most typically satisfied via a ViewResult. Conventions in the framework come into play to look for a view to render with the same name as the action that was called, but this is not strictly required and can be overridden. Regardless, the view (your *.cshtml file) is rendered by Razor utilizing data provided by the action and returned as a response to the client.
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
Creating controller with
app/console doctrine:generate:crud
ends up with an error:
[Twig_Error_Loader]
Unable to find template "crud/views/layout.html.twig.twig"
(looked into: ...\vendor\sensio\generator-bundle\Sensio\Bundle\GeneratorBundle\Command/../Resources/skeleton,
...\vendor\sensio\generator-bundle\Sensio\Bundle\GeneratorBundle\Command/../Resources).
In the requested directory I can't find a template like "crud/views/layout.html.twig.twig".
Any help appreciated,
Use find text in the files with Netbeans or Notepad++ for searching next string:
layout.html.twig.twig
maybe you have this template name in any parent templates or your controllers.
Or for test, try to create crud/views/layout.html.twig.twig template and generate crud again.