Optimize Entity Query output for ForEach loop processing
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3571277. -->
Reported by: [joevagyok](https://www.drupal.org/user/2876343)
>>>
<h3>Summary</h3>
<p>The Entity Query node's output is optimized for use with the ForEach loop node, enabling efficient batch processing of query results.</p>
<h3>Business Value</h3>
<ul>
<li>Enables batch processing workflows with minimal configuration</li>
<li>Provides consistent data structure for iteration</li>
<li>Supports both lightweight (IDs only) and full entity processing</li>
<li>Optimizes memory usage for large result sets</li>
</ul>
<h3>Results Array Structure</h3>
<p>Each item in the <code>results</code> array contains:</p>
<ul>
<li><code>id</code>: Entity ID</li>
<li><code>uuid</code>: Entity UUID</li>
<li><code>label</code>: Entity label/title</li>
<li><code>bundle</code>: Entity bundle (content type)</li>
<li><code>entity_type</code>: Entity type (when load_entities=false)</li>
<li><code>entity</code>: Full serialized entity (when load_entities=true)</li>
</ul>
<h3>Processing Patterns</h3>
<ul>
<li><strong>Lightweight:</strong> Query IDs only, load entities individually in loop for memory efficiency</li>
<li><strong>Bulk:</strong> Load all entities upfront for faster processing of smaller sets</li>
<li><strong>Paginated:</strong> Use offset/limit with has_more flag for processing large datasets</li>
</ul>
<h3>Example Workflow Pattern</h3>
<ol>
<li>Entity Query node queries articles modified in last 24 hours</li>
<li>ForEach loop iterates over results array</li>
<li>Inside loop: process, transform, or validate each entity</li>
<li>Entity Save node persists changes</li>
</ol>
issue