I have following @Route annottations for my Controller’s method:
/**
* @Route("/{id}/edit", name="section_edit")
* @Route("/{id}/duplicate", name="section_duplicate")
* @Method({"GET", "POST"})
* @Template
*/
public function editAction(Request $request, $id)
{
}
Is it possible to discover, which route was called ? edit or duplicate ?
I did it because the logic for both routes is simmilar. I can create two actions which will call the same method with specified parameter, but I wonder if it is possible to do it with one method and define some $method parameter with edit/duplicate value.
Solution is quite simple – adding
defaultswith no relation to the pattern – as below: