Hey I am trying to make a href with current year and month, sent with get request to a controller function this way <a href="{{ path('transactions', {'year' : date("Y"), 'month' : date("n")}) }}"></a> and im getting "An exception has been thrown during the rendering of a template ("Warning: preg_match() expects parameter 2 to be string, object given")."
<a href="{{ path('transactions', {'year' : date("Y"), 'month' : date("n")}) }}"></a>
I assume that I am getting an object instead of string but I have no clue how to overcome it and I didn't found any reasonable way to solve it.
To default way to do it inside twig is using NOW, e.g.
twig
NOW
<a href="{{ path('transactions', {'year' : 'NOW'|date('Y'), 'month' : 'NOW'|date('m'), }) }}"></a>
documentation
1.4m articles
1.4m replys
5 comments
57.0k users