optional parameters in routes defined through annotations

Viewed 30524

is there a more elegant way to define optional parameters in annotated routes then to define 2 annotations?

Here's how I did it:

/**
*
* @Route("/view/{lang}/{file}", name="legacy_translation_view_file")
* @Route("/view/{lang}", name="legacy_translation_view")
* @Template()
*/
public function viewAction($lang,$file=null)
{
   ...
}

i've seen that the annotation class has a field named "defaults" but am not quiet sure about the syntax

thx

1 Answers
Related