Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 2 Routing Annotation with container parameter

Tags:

symfony

I am trying to "port" yml routing to annotations. In yml I have route:

homepage_foo:
    pattern:  /foo
    defaults: { _controller: FooBundle:Homepage:foo }
    schemes:  [%httpProtocol%]

where %httpProtocol% is parameter from container.

With annotation, similar approach is not working:

/**
  * @Route("/foo", name="homepage_foo", schemes={%httpProtocol%})
  */

I am trying to use parameter %httpProtocol% with annotation. Is it possible with different syntax?

like image 442
Jakub Šimon Avatar asked Dec 10 '25 10:12

Jakub Šimon


1 Answers

Works with:

/**
 * @Route("/foo", name="homepage_foo", schemes="%httpProtocol%")
 */
like image 54
Jakub Šimon Avatar answered Dec 13 '25 00:12

Jakub Šimon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!