Search code examples
twigshopware6

Iterating over ArrayEntity


We were have this backend code:

$event->getPage()->addExtension('downloads', new ArrayEntity($downloads));

In the twig

{{ dump(page.extensions.downloads) }}

shows the Array entity.

Before the Shopware updates

This loop worked:

{% for key, files in page.extensions.downloads.data %}

But now it doesn't (data is null)

Also

{% for key, files in page.extensions.downloads %}

does not work.

How to iterate over the array entity in twig?


Solution

  • {% for key, files in page.extensions.downloads.all %}
    

    works