Override one route in symfony2

How can I redefine one route in Symfony2?

I have a package that comes with bundle_routing.yml file.
In a bundle that extends this parent package, I also have a routing file: routing.xml
Please note that the files are called different.

in this routing file, I like to redefine one parent route.
I tried a simple redesign and changed the template.
But it is not used.

Parent:

MyParentBundle_detailpage: pattern: /detail defaults: { _controller: "MyParentBundle:Item:detail" } 

child:

 <route id="MyParentBundle_detailpage" pattern="/itemDetails"> <default key="_controller">MyParentBundle:Item:detail</default> </route> 
+4
source share
1 answer

I found the reason myself: Its because of the import order in the main routing file.

 app/config/routing.yml 

Parent routing must be imported first, and daughter routing must be imported second.

 MyParentBundle: resource: "@MyParentBundle/Resources/config/bundle_routing.yml" prefix: / MyChildBundle: resource: "@MyChildBundle/Resources/config/routing.xml" prefix: / 
+11
source

Source: https://habr.com/ru/post/1444580/


All Articles