I'm trying to duplicate entries inside a macro, which will displays duplicated items inside a carousel.

It's not possible to merge Element Queries. Even if it's possible to merge IDs, merging an array of IDs will end up with non-duplicated entries.

This is how I duplicate entries:

{% set entries = entries | merge(entries) %}

After that, this is how I loop, and the resulting issue:

  • for entry in entries.all()
    • → Twig error: Impossible to invoke a method ("all") on an array;
  • for entry in entries
    • → deprecated warning: Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them;
  • for entry in entries.all() ?? entries or entry in entries ?? entries.all()
    • → same warning as previous point;

1 Answer 1


Instead of duplicating the entries, you could run your entries loop twice (or as many times as you want) maybe?

{% for i in 0..1 %}
    {% for entry in entries %}
        {{ entry.title }}   <br>
    {% endfor %}
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.