Questions tagged [symfony-routing]

Routing in Symfony Framework's MVC implementation. Symfony is a free, open source PHP web application framework, and it is released under the MIT license.

symfony-routing is a tag suitable for any questions regarding routing in Symfony's MVC implementation, url handling, or any other matter affecting or affected by routing in Symfony.

196 questions
1
vote
2 answers

Route @Method annotation doesn't seem to get respected when matching routes

I understand when allowing similarly accessible routes, that the order of the routes matter. Where I'm confused is why when submitting a DELETE request to this route, does it match to the GET route, instead of ignoring it and trying the matched…
RedactedProfile
  • 2,748
  • 6
  • 32
  • 51
1
vote
2 answers

Debug TYPO3 site configuration

I have to update a complicated RealURL configuration to the new site configuration in V9. I get 404 errors and unwanted redirects, so I need something to debug the routing. While debugging through core files I realized TYPO3 uses Symfony Routing,…
1
vote
2 answers

How to manually set router locale in Symfony 2.8

I am running a Symfony 2.8 based web app which uses FOSUserBundle to handle users. The FOSUserBundle routes are imported using the current locale as prefix: // app/config/routing.yml ... # fos_userbundle user: resource:…
Andrei Herford
  • 17,570
  • 19
  • 91
  • 225
1
vote
1 answer

Custom 404 error template in twig 2.5 with symfony 4.1

I created customs Twig templates for http error display to keep the site design unified by extending my base layout. (I want to keep my navigation menu and display the error, unlike the regular error messages) It's working as expected but for the…
Cid
  • 14,968
  • 4
  • 30
  • 45
1
vote
1 answer

Symfony Route. Can't set annotations

I can't understand, if i create crud controller with bin/console make:crud all routes work from controller like /** * @Route("/", name="product_index", methods="GET") */ public function index(ProductRepository $productRepository): Response { …
Loctarogar
  • 540
  • 3
  • 10
  • 29
1
vote
2 answers

Symfony 4 bugged route

I was trying to create a route type "any" to allow both get and post but it did not work so I tried adding two routes to my route annotation like this /** * @Route("/news", name="newsSinglePOST", methods={"post"}) * @Route("/news",…
Sam
  • 1,557
  • 3
  • 26
  • 51
1
vote
0 answers

Use glob pattern to include controllers annotations routing with Symfony 4

I want to include all controllers for route annotation, giving a routes/annotations.yaml: controllers: resource: ../../src/{Site,Dashboard}/Controller/ type: annotation The glob component is not giving folders but null (whereas files…
Thomas Decaux
  • 21,738
  • 2
  • 113
  • 124
1
vote
1 answer

Symfony 3 - route requirements - all URL-parts mapped to parameter 1 when defining a route requirement

I am working on a project with Symfony 3.3.10. I defined a route with 3 parameters like this /** * @Route("/{_locale}/{cat_1}/{cat_2}/{cat_3}", name="cat_site", * defaults={"cat_1" = "", "cat_2" = "", "cat_3" = ""}) */ public function…
user3440145
  • 793
  • 10
  • 34
1
vote
1 answer

No route found, Symfony routing not updating properly

My routing.yml: user_user: resource: "@UserUserBundle/Resources/config/routing.yml" prefix: /user book_book: resource: "@BookBookBundle/Resources/config/routing.yml" prefix: /book index_index: resource:…
Иво Недев
  • 1,570
  • 1
  • 20
  • 33
1
vote
1 answer

Get data from a Symfony controller action with AJAX

I have a simple showAction to show a user's information: /** * @Route("/user/{id}", name="show_user", options={"expose"=true}) * @Method("GET") * * @param User $user * @return \Symfony\Component\HttpFoundation\Response */ public function…
Mentos93
  • 581
  • 1
  • 7
  • 28
1
vote
1 answer

How to define in @Route with #name

I'm new with Symfony 3, and I'm trying to figure how to implement in my @Route with #order just only to show the exact position of the render page... but when I define in my @Route this way: @Route("/{orderNumber}/details{_attr}" <--- this…
AnubisVolga
  • 311
  • 3
  • 18
1
vote
1 answer

symfony 3 and FOSRest Bundle Routing

I am trying to setup the symfony3 codebase with FOS REST Bundle and I end up getting no route found error AppBundle\Resources\config\api-routing.yml check: type: rest resource:…
user269867
  • 3,266
  • 9
  • 45
  • 65
1
vote
3 answers

Symfony redirect to dynamic route name

I'm using the Symfony CMF Routing Bundle to create dynamic routes (I'm using one example here): $route = new Route('/dynamic-url'); $route->setMethods("GET"); $route->setDefault('_controller',…
BigJ
  • 1,990
  • 2
  • 29
  • 47
1
vote
1 answer

Symfony: how to configure default options for all routes?

Can I configure the following option in a single place rather than per route? In my routing.yml file every route has: options: utf8: true Because of In Symfony 3.2, there is no need to explicitly set the utf8 option. As soon as Symfony finds a…
cloakedninjas
  • 4,007
  • 2
  • 31
  • 45
1
vote
2 answers

Symfony 3 Redirect to another routhe with url parameter

On my Symfony 3 project I have made the following contoller: /** * @Route("/person_in_need/{id}",name="person_in_need_view") */ public function viewPersonInNeed(Request $request,$id) { } And I want to redirect in it from…
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164