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
0
votes
2 answers

How can I add a route requirement which requires a service method?

I need to build a route which has a dynamic condition. For the moment, I simply use requirements in order the match against a static list a words: /** * @Route( * "/{category}/{id}", * requirements={ * "category"="^(foo|bar)$" *…
yolenoyer
  • 8,797
  • 2
  • 27
  • 61
0
votes
1 answer

Can't override homepage trailing slash

My site have no "homepage" that use the base url (mydomain.com) The default routing include the _locale parameter, and thus, fail to match one part of the route depending on how I set it. Config A homepage: path: /{_locale}/ defaults: …
Preciel
  • 2,666
  • 3
  • 20
  • 45
0
votes
1 answer

Call a function multiple time and get all value as single list php

I want to call a method multiple time and get all result as single array or anything . As example laravel Web.php file
0
votes
0 answers

Symfony 4: match route only when there is no subdomain

I want to match a route only when there is no subdomain in the url: Here is the route where I match the subdomain being "api" /** * @Route("/properties/save", host="api.{host}", name="api_property_save",requirements={"host"=".*"},methods={"PUT"}) …
Vlad Dogarescu
  • 153
  • 1
  • 11
0
votes
1 answer

Symfony 403 thrown with correct role

Weird issue here. I have a 403 error when I try to access a endpoint of my API whereas the users's role is correct. Here's my route's annotation (I'm using FosRestBundle) /** * @Rest\Get("home/{id}/versions", requirements={"id"="\d+"}) *…
loicb
  • 587
  • 2
  • 6
  • 24
0
votes
1 answer

Can't get POST parameters in controller

I'm experimenting with Symfony and I am trying to make a POST request. But I can't seem to get the request's POST parameters inside my controller. /** * @Route("/messages/comment/post/", methods={"POST"}, name="postComment") */ public function…
Sinan Samet
  • 6,432
  • 12
  • 50
  • 93
0
votes
1 answer

Symfony: Generate URL route not found but it exists

Here's a problem I've got to face a lot and I think that many people are having the same problem: I try to call an action in controller and then to redirect to the URL I came from. Let me show you the code: I've got a basic form whose parameters are…
MaximeADT
  • 1
  • 1
0
votes
3 answers

How to include hashtag in Symfony routing

I need to create routing like http://localhost:89/app_dev.php/list#gold-coin So it will open specific tab on navigation. But my routing not working as expected. shop_product: path: /list#{slug} methods: [GET] Edit: I have three tabs…
stefun
  • 1,261
  • 3
  • 24
  • 54
0
votes
1 answer

Symfony match a route to host is not working

I need to set a route in my Symfony (2.8) project to be loaded when one of the sub domains are accessed. Let's say my site is hosted under "example.com" and its admin needs to be loaded for "admin.example.com". I know in Symfony we can use host:…
Teshan N.
  • 2,307
  • 3
  • 30
  • 59
0
votes
1 answer

Symfony 404 No route found for "GET /admin/users/"

config/routes.yaml admin_users: resource: '@ProjectUserBundle/Resources/config/routing.yml' prefix: /admin app_locations: resource: '../src/Project/LocationBundle/Controller/' type: …
Mookum
  • 33
  • 7
0
votes
0 answers

Parameter injection for symfony render_esi (listener instead of static in template)

I'm aware that one can add parameters for the esi request like {{ render_esi('bundle:controller:action', {foo: 'bar'}) (would add the parameter foo with the value bar to the fragment uri). My task requires setting this parameter dynamically from…
Catmzero
  • 113
  • 7
0
votes
1 answer

Symfony 3.3: Use php file inside bundle to load routes expects class

To my Symfony version 3.3 project at app/config/routing.yml file I have put: AppBundle: resource: '@AppBundle/Resources/config/routing.php' prefix: / type: 'php' And on src/AppBundle/Resources/config/routing.php I have put the…
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
0
votes
1 answer

How can I programmatically modify a route from a different bundle in Symfony 3?

I'm using the FOSRestBundle and would like to modify the routes it creates. I intend to add default parameters to each route the Rest Bundle creates. I've looked through the symfony docs on routing and have found nothing covering this use case. If…
dlporter98
  • 1,590
  • 1
  • 12
  • 18
0
votes
1 answer

How to check for absolute paths/routes in Symfony?

First of all thank you for taking your time takling this difficult topic. Goal: My URL structure is like facebook/twitter: site.com/Username To let the user set the username, I need to check if a path of a route matches a username. Possibilities &…
emovere
  • 152
  • 1
  • 13
0
votes
1 answer

How to move slug to subdomain in Symfony3

I have a web-app where every User has his own personalized link https://app.myapp.com/{uuid}/frontpage Where uuid indicates User resource loaded from the database. And now, the idea is to move /{uuid}/ to subdomain, so it should look as…
undefinedman
  • 620
  • 1
  • 11
  • 25