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
3
votes
1 answer

Routing redirection not working properly (Symfony 3)

I have an issue with my application, I have several routes declared on my controller which works properly but I have trouble with one of them. I used the annotation system to declare the route of this method (like all my routes which works) like…
jona
  • 31
  • 1
  • 3
3
votes
1 answer

Incorrect domain for an URL in a Twig template using command

In my Symfony2 project, I send email with a link to connect to my website, like LOGIN When I use this template in a controller, the link is good. LOGIN But if I use this…
eluus
  • 213
  • 1
  • 13
3
votes
2 answers

Router and {slug} to retrieve entity

In an entity, I've define a slug with the DoctrineExtension, I use it in my href. But... I've a problem with the Router and/or ParamConverter. In my controller: /** * @Route("/{slug}", name="strain_view") * @ParamConverter("strain",…
mpiot
  • 1,482
  • 2
  • 15
  • 36
3
votes
1 answer

Symfony 3 Routing: No route found for "GET /user/add"

I am developing a simple User App to practice Symfony (3.1.3). I created a new Bundle, //pie10-api/api/src/PIE10Bundle/Controller/BackendUmController.php
mapmalith
  • 1,303
  • 21
  • 38
3
votes
1 answer

Symfony2 Routing for Doctrine2 Tree Menu

I have a symfony2 build on at the moment. I have installed and configured the StofDoctrineExtensionsBundle so that i can store categories for my "store" view in a nestedset structure. This is working perfectly i can output the nested tree…
Tom Burman
  • 947
  • 3
  • 15
  • 37
3
votes
1 answer

FileLoaderImportCircularReferenceException after created Bundle in Symfony2

I am new in Symfony development and I have created my first project and my first bundle with the command line php app\console generate:bundle. Normally, I should be able to use this new bundle and access to the URL hello/{name}, but when I am trying…
rolandl
  • 1,769
  • 1
  • 25
  • 48
3
votes
1 answer

Symfony2 Routing: import all controllers' annotations BUT exclude one (duplicated routes in NelmioApiDoc)

The problem When we define in routing.yml: my_controllers: resource: "@MyBundle/Controller/" type: annotation prefix: / and: my_api: resource: 'MyBundle\Controller\ApiController' type: rest prefix: /api …
Wirone
  • 3,304
  • 1
  • 29
  • 48
3
votes
2 answers

Access global parameters from route condition expressions in Symfony

I'm trying to access app-wide symfony parameters (defined in app/config/parameters.yml) from an expression in a route condition (documentation). I tried my luck inserting the parameter within percentage signs and through the function "parameter" (as…
Phil Thomas
  • 1,237
  • 1
  • 12
  • 33
3
votes
1 answer

How to change the Host used in route generation for a twig template?

Ok so i have a controller with an action and 2 routes associated with it: /** * @Route("/index/preview/", name="mybundle.preview_index") * @Route("/", name="mybundle.index") * @Template */ public function indexAction(Request $request) { …
Chase
  • 9,289
  • 5
  • 51
  • 77
3
votes
2 answers

Symfony2 URL translate and structure for multilanguage site

How I can make a dynamic url structure according with the user's locale in Symfony2? I explain better... The problem is not about the language-prefix changes into the URL. It works well. The problem is into the "static" part of the URL. For example…
Roberto Rizzi
  • 1,525
  • 5
  • 26
  • 39
2
votes
0 answers

Why Symfony generates route with kernel name?

I can't realize, why Symfony generates the route kernel: resource: ../../src/Kernel.php type: annotation I read documentation https://symfony.com/doc/current/routing.html#creating-routes-as-attributes-or-annotations This command also…
zalex
  • 729
  • 6
  • 14
2
votes
1 answer

How to use different controllers, depending on the user role, for the same route?

I'm trying to implement multiple controllers which listens to one route /account. There are two controllers and only one should be executed on that URL where the choice lies within user's role. namespace AppBundle\Controller; use…
Nick
  • 169
  • 1
  • 10
2
votes
2 answers

Symfony Always Include Route Default Values

So basically I am trying to achieve this: New in Symfony 4.3: Always Include Route Default Values I have a task entity, which has multiple states like new, open & closed. For this reason I am trying to generate a route /tasks/new /tasks/open…
Syllz
  • 290
  • 6
  • 22
2
votes
1 answer

Remove default locale prefix in symfony routing components

I work Only with symfony routing components in personal project(without full symfony framwork). my method is: add route in routes.yaml file like this: index: path: /test methods: GET controller:…
NewCod3r
  • 1,168
  • 1
  • 12
  • 28
2
votes
1 answer

Symfony Route Conditions DSL Context

The short version: What objects do I, the end user programmer, have access to when using Symfony's routing conditions? The long version: Symfony routes allow you to use a key named condition. contact: path: /contact controller:…
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
1 2
3
13 14