I
I
Igor2019-09-24 15:10:26
symfony
Igor, 2019-09-24 15:10:26

Symfony multi-core?

Colleagues, good afternoon.
The question is addressed to connoisseurs of Symfony
I have 2 identical controllers, but with different environments.
Also, the project implemented multi-core.
But there is a not pleasant feature.
admin.food.local/product.get
api.food.local/product.get
Depending on the call to the corresponding address, the corresponding controller is called.
/product.get", name="product_get" if you don't set router name -- router environment admin
/product.get", name="product_get" if you don't set router name -- router environment api
For some reason, the controller is invoked only api environments
But if you do not set the name parameter, then there is no problem.
What does the name parameter affect?
5d8a061d7ecbe270515557.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Rybalka, 2019-09-25
@IgorPI

Each route must be unique. the uniqueness of the route is set, in fact, by the name parameter. If you don't specify it, name is automatically generated from the controller's name and the action's name. If you specify two actions with the same route name in the project, the one that is declared first / last will always work for you (I don’t remember exactly here).
Name the routes api_product_get and admin_product_get

D
Denis Derepko, 2019-09-24
@uDenX

Tried?
https://symfony.com/doc/current/routing.html#sub-d...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question