3

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?

7
  • Have you imported the annotation for that controller (or for all)?
    – gp_sflover
    Commented Oct 1, 2014 at 17:09
  • Yes, sorry, annotations as such works. I corrected question, it does not work with schemes={%httpProtocol%} Commented Oct 1, 2014 at 17:15
  • Try like did in "name-placeholders" adding: schemes={httpProtocol} and requirements = { "httpProtocol" = "%httpProtocol%"
    – gp_sflover
    Commented Oct 1, 2014 at 17:32
  • No success with this:/ Commented Oct 1, 2014 at 18:34
  • 1
    PS: In my previous comment there is a TYPO because I forgot to add the ending bracket in requirements.
    – gp_sflover
    Commented Oct 1, 2014 at 18:49

1 Answer 1

4

Works with:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.