The key "path" for the array with the keys "" does not exist, but the dump says that it

I am currently working on cms using symfony2 as the base structure and branch as the template engine.

My problem is this:

So far this

{% for image in images %}
    {{ dump(image.path is defined) }}
{% endfor %}

returns true for each element of the array, ...

... but this

{% for image in images %}
    {{ image.path}}
{% endfor %}

issues exemption.

The key "path" for the array with the keys "" does not exist

The convolution for the images array returns an array:

array(2) {
    [0]=> object(stdClass)#2759 (9) {
        ["id"]=> string(5) "17795"
        ["typ"]=> string(3) "jpg"
        ["path"]=> string(10) "Tulips.jpg"
    }
    [1]=> object(stdClass)#2874 (9) {
        ["id"]=> string(5) "17796"
        ["typ"]=> string(3) "jpg"
        ["path"]=> string(14) "Hydrangeas.jpg"
    }
}

This seems like a paradox to me, and I really don't get it. Does anyone have an idea? I would be very grateful, the deadlines are coming ...: /

+4
source share
1 answer

, u . foreach twig .

{% for image in images %}
    {% for i in image %}
       {{ i.datei }}
    {% endfor %}
{% endfor %}
+2

All Articles