我必须将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 %}
谢谢。