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

Symfony 6.1 Route Priority for Multiple Controllers

In a Symfony 6.1 project, I have created a TopicController with #[Route('/{topic}', name: 'topic.index', methods: ['GET'])] and then I created PhotographerController with #[Route('/', name: 'photographer.index', methods: ['GET'], priority:…
Ariful Haque
  • 3,662
  • 5
  • 37
  • 59
0
votes
1 answer

Routing problem after upgrading from LTS 8 to LTS 9 (RealURL -> Core routing)

After migrating our site from version 8 LTS to version 9 LTS, I have some configuration problems with the routing. With RealURL we use the fixedPostVars, 'noMatch' => 'bypass'. For example with this…
SteveLeg
  • 87
  • 12
0
votes
0 answers

Why my Symfony route is overridden by other routes?

I use annotations to define routes in my project. I have a controller method that has such a route: /** * @Route("/{slug}", name="showcompany") */ public function show(Company $company): Response { ... } This is done to catch requests like…
0
votes
1 answer

Dynamic routing & templates in symfony

Recently while building my CMS in Symfony, I've run into a problem. I have 2 controllers, publicationcontroller and contactcontroller. In both controllers, an instance of the entity Page is loaded whenever a corresponding slug matches. Below is the…
Coderz99
  • 1
  • 3
0
votes
2 answers

How to use PHP constant in routing YAML

I'm using Symfony 3.4 I managed to get the PHP constant to work for a service (as described in the documentation). But I can't figure out how to get it to work in a routing file. Here's what I have so far. Entity: namespace…
Arafor
  • 13
  • 2
0
votes
2 answers

Symfony 4 - User becomes null on callback from external API service

On Symfony 4, when catching a callback route from any external API service (in this case - Shopify API), my logged in user becomes anon. (HTTP): Everything works when testing on localhost (HTTPS): However, my logged in User becomes null / Anonymous…
0
votes
1 answer

Internationalized routing don't work fine with security access controls

I'm trying to use Internationalized routing. So for one route many URLs. But one route still being uniquely identified by its name. This is a great feature but the doc don't says how to deal with the security component. In fact, I'm using url to…
0
votes
1 answer

Symfony5 throws 404 in browser, but route is found in cli

Iam using react+symfony with webpack. Everything works with simple url eg. one slash in url ("/aboutus","/moodle") but when i try access route with multiple slashes("/admin/users") i get NotFoundResource Error. But with router:matchi will find…
0
votes
0 answers

How handle router with container's services/parameters dynamically?

I've used the Symfony route bundle and DI bundle in my non Symfony project. I inject dependencies to the controllers/actions by the code below: // Find the current route $parameters = $router->match($requestContext->getPathInfo()); …
Fatemeh Gharri
  • 369
  • 2
  • 6
  • 20
0
votes
1 answer

TYPO3 9 Routing - the parameter gets overwritten by the defaults

I'm trying to create a URL-structure like /maincategory/subcategory/ and this works, it looks good but with my code it loses the parameter "mwWsCategory2" and replaces it with the value under "defaults". In this example the Parameter "mwWsCategory2"…
Markenwirt
  • 31
  • 4
0
votes
0 answers

Symfony 2.8 how to get Route option

With EventListener I use my lass TransactionListener. This class check permission for current url. Some URL are open. I check it by attribut "option" in routing.yml For getting option on current route I use very slow method $route =…
0
votes
1 answer

Symfony onKernelRequest headers->set dont received on @Route

I have functionm onKernelRequest when i want to add some custom header(in my case api=true||$request->headers->set('api', "true")) and in all Request $request i can get that header but when i try it on annotation its fail: onKernelRequest: public…
0
votes
0 answers

Validate optional input GET parameters passed in through the querystring as integers in Symfony 3.4

In Symfony 3.4, is there a way to validate optional input GET parameters passed in through the querystring as integers? If provided, I am using the $ownerId and $courseId to query the corresponding repositories, however the value needs to be an…
crmpicco
  • 16,605
  • 26
  • 134
  • 210
0
votes
1 answer

How to add prefix to some controllers using annotations?

I have at the moment two controllers. GitlabAuthController UserController I need to add the path prefix api to UserController only. Before I was trying following at annotations.yaml file: controllers: resource: ../../src/Controller/ type:…
nas
  • 2,289
  • 5
  • 32
  • 67
0
votes
1 answer

Route Not Found In Prefix Root Path

I'm trying to setting up symfony/routing component on my project.. Things go well but when I define prefix for routes, it throw route not found exception for root path of this prefix. For example, let assume I have bunch of admin routes. Instead…
Teoman Tıngır
  • 2,766
  • 2
  • 21
  • 41