Symfony Routing: Options in Annotations
symfony
Solution
Although it's not documented, the @Route annotation sets other route properties the using the same syntax as requirements and defaults:
/**
* @Route("/hello/{name}", name="hello_world", requirements={"name" = "\w+"}, defaults={"name" = "World"}, options={"option" = "value"})
*/
Problem
In symfony2, in the routing YAML configurations, you can have an array of options. It looks like this: ``` example_route: pattern: /test/route options: option1: value1 option2: value2 ``` Some of the routes however, are defined within Annotations instead for pretty specific reasons, but I need to add some "options" to those. I only see a few fields for Annotations, like: ``` @Route and @Method @ParamConverter @Template @Cache @Security ``` and none of those appear to allow injection into the Route objects Options array. Is there a solution to accomplish this?