0

I'm calling the controller from Twig to the following expression:

 {{ render(controller("Bundle:Holidays:HolidaysPerMonth", { 'id': '{{ "now"|date("m") }}' })) }}

The problem I have is that the driver does not recognize the value of the variable, which corresponds to the current month (two digits). If I change { 'id': '{{ "now"|date("m") }}' } for { 'id': '05' } the controller already recognizes the variable and the result is obtained correctly, so the problem is how I can pass that value.

4
  • 2
    ... { 'id': ("now"|date("m")) } ... Commented May 10, 2016 at 11:46
  • why are you quoting the variable? it should be just {{ render(controller("Bundle:Holidays:HolidaysPerMonth", { 'id': ' "now"|date("m") ' })) }} Commented May 10, 2016 at 11:49
  • 1
    You mean {{ render(controller("Bundle:Holidays:HolidaysPerMonth", { 'id': "now"|date("m") })) }} Commented May 10, 2016 at 11:52
  • It's like you comment, thank you very much. Commented May 10, 2016 at 12:10

1 Answer 1

1

How you have given me, the solution is using the following expression for the variable:

 { 'id': ("now"|date("m")) }

Thank you very much

Sign up to request clarification or add additional context in comments.

Comments

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.