我必须使用Twig变量作为另一个Twig变量的属性.
在for循环中,我获取特定实体的属性,并希望使用这些属性来获取另一个for循环中的实体变量的属性内容.
一些代码清楚地说明了这一点:
{% for entity in entities %}
{{entity.foo}}, {{entity.bar}}<br />
{% for property in specialdynamicproperties %}
{{entity.property}} <!-- property has the content foobar for example, I want to use it as the property accessor for entity -->
{% endfor %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)
谢谢.