Symfony 6.1 Route Priority for Multiple Controllers

346 Views Asked by At

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: 10)]

Problem:

Now if I try /anytopic , this goes to the TopicController, and /photographers also goes to the TopicController.

Question:

How can I force /photographers controller to go to PhotographerController?

I tried to add priority: 10 to PhotographerController like bellow, but it is not working.

#[Route('/', name: 'photographer.index', methods: ['GET'], priority: 10)]

routes.yaml file

controllers:
    resource: ../src/Controller/
    type: attribute
0

There are 0 best solutions below