是否可以在 symfony2 中动态设置路由的默认参数值?

问题描述:

我在 symfony2 控制器中使用注释定义了一个路由.EG:

I have a route defined in a symfony2 controller using annotations. EG:

@Route("/{year}", name="show_list_for_user", defaults={ "year" = "2012" })

是否可以使默认年份动态化.也许从服务对象中读取年份?

Is it possible to make make the default year dynamic. Maybe to read the year from a service object?

恐怕这是不可能的,默认值是静态的.

I'm afraid that is not possible, the defaults are static.