Body: <p>Is there a way to create an array of items, fetch them with .all() and loop through them?  For example:</p>
  
  <pre><code>{% set array = array|merge([block]) %}
  
  {% for block in gallery.all() %}
  {% endfor %}  
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-29T18:18:26.077Z
Comments.Text: `.all()` lives in the element query classes, not on an array.  If you've already got your results in array format, why not just loop through them directly?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-30T06:02:11.153Z
Comments.Text: I was just curious to know if there is a way to do so, but looping through as an array is fine.
Comments.UserDisplayName: nmsdvid
Tags: <craft3><forloop>
Title: How to create an array of items and fetch them with .all()?
ThreadText: # How to create an array of items and fetch them with .all()?
  
  (Asked by: username_0 on 2019-07-29)
  
  Is there a way to create an array of items, fetch them with .all() and loop through them? For example:
  
  ```
  {% set array = array|merge([block]) %}
  
  {% for block in gallery.all() %}
  {% endfor %}  
  
  ```
  
  **Tags:** craft3, forloop
  
  > **Comments:**
  > **username_1**: `.all()` lives in the element query classes, not on an array.  If you've already got your results in array format, why not just loop through them directly?  
  > **username_0**: I was just curious to know if there is a way to do so, but looping through as an array is fine.  
  
  ---
  
  ## 0 answers
  
  