<p>Update after Brad's comment since the <code>with</code> part seems to be ok - by the way thank you, it is another good example that you never stop learning.</p>

<p><s>I never saw that <code>with</code> attribute in a <code>ElementCriteriaModel</code> and after several searches I could not find any use of that attribute in craft (Please correct me if I'm wrong)</s> the rest should be fine. </p>

<p>Instead of the <code>.limit(1)</code> you could do the following</p>

<pre><code>{% set content = entry.contentBuilder.type('copy').first() %}
</code></pre>

<p>The <code>getPage()</code> function only exists in the class <code>RichTextData</code> maybe you have a different fieldType? Otherwise you could just do <code>{{ content.copy }}</code> as well to display the text in that field.</p>

<p>All in all it would be a good idea to tell us a little bit more about your goal, your fields and your errors. Your description is a little bit insufficient in my opinion </p>

CC BY-SA 3.0
2017-11-12T22:17:57.810Z
The `with` eager loading syntax looks O.K. to me https://craftcms.com/docs/templating/eager-loading-elements#defining-custom-parameters-on-eager-loaded-elements
Brad Bell
CC BY-SA 3.0
2017-11-12T20:43:52.970Z
2017-11-12T22:34:50.067Z
2017-11-12T22:34:50.067Z
Robin Schambach
<p>Can anyone provide a working example to extend the following code (add support for matrix block named "copy") and allow getPage usage:</p>

<pre><code>{% set entries = craft.entries({
   section: ['news'],
   order: 'postDate desc',
   limit: 5,
   with: [
     ['assets', { kind: 'image' }]
   ]
}) %}


{% for content in entry.contentBuilder.type('copy').limit(1) %}
   {{ content.copy.getPage(1) }}
{% endfor %}
</code></pre>

<matrix><eager-loading>
Eager-loading of matrix field with getPage
# Eager-loading of matrix field with getPage

(Asked by: username_0 on 2017-11-12)

Can anyone provide a working example to extend the following code (add support for matrix block named "copy") and allow getPage usage:
{% set entries = craft.entries({
   section: ['news'],
   order: 'postDate desc',
   limit: 5,
   with: [
     ['assets', { kind: 'image' }]
   ]
}) %}


{% for content in entry.contentBuilder.type('copy').limit(1) %}
   {{ content.copy.getPage(1) }}
{% endfor %}

**Tags:** matrix, eager-loading

---

## 1 answers

### Answer by username_1 on 2017-11-12. Score: 1

Update after Brad's comment since the with part seems to be ok - by the way thank you, it is another good example that you never stop learning.
I never saw that with attribute in a ElementCriteriaModel and after several searches I could not find any use of that attribute in craft (Please correct me if I'm wrong) the rest should be fine. 
Instead of the .limit(1) you could do the following
{% set content = entry.contentBuilder.type('copy').first() %}

The getPage() function only exists in the class RichTextData maybe you have a different fieldType? Otherwise you could just do {{ content.copy }} as well to display the text in that field.
All in all it would be a good idea to tell us a little bit more about your goal, your fields and your errors. Your description is a little bit insufficient in my opinion

> **Comments:**
> **username_2**: The `with` eager loading syntax looks O.K. to me https://craftcms.com/docs/templating/eager-loading-elements#defining-custom-parameters-on-eager-loaded-elements  

---

