1
我有一個路線定義是這樣的:發送參數路由symfony的枝杈
reuzze_reuzze_categoryentitiespage:
pattern: /category/entities/{category_id}
defaults: { _controller: ReuzzeReuzzeBundle:Category:entities }
我有我的觀點類別中,我通過要循環,這樣創建超鏈接:
{% for name, category in categories %}
<li>{{ name }}</li>
<ul>
{% for key, string in category %}
<li><a href="{{ path('reuzze_reuzze_categoryentitiespage', {'category_id': {{ key }} }) }}">{{ string }}</a></li>
{% endfor %}
</ul>
{% endfor %}
但我這樣做的時候,我總是得到這個錯誤:
A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{" in ReuzzeReuzzeBundle:Search:entitiesfromsearch.html.twig at line 12
我在做什麼錯?