I have an action which capable on several routes. I just defined the conflict part here.
/**
* @Route("/arama/ilanlar/{vehicleType}", requirements={"vehicleType"="(^$|araba|ticari-arac|motosiklet)"}, name="offer_search_fulltext_vehicletype")
* @Route("/{vehicleType}/{brand}", requirements={"vehicleType"="(araba|ticari-arac|motosiklet)", "brand"="[\w_-]+"}, name="offer_browse_vehicletype_brand")
* @Method({"GET"})
* @Template()
*/
public function searchAction(
Request $request,
$vehicleType = null,
$brand = null,
) {
---
}
for the first routing "brand" var may come as a GET parameter, but in twig path and url function passes this variable it still gets "brand" var as url parameter which I give null in action function definition.
I tried below line for setting route params but it didn't worked. How could I prevent this overriding ? I have to use same variable name on routing and get, if not it will break dynamism all over the code.
$request->attributes->set('_route_params', array_filter($request->get('_route_params')));
Do you have any idea ?