Is there a way to earger load related submissions? #567
-
I have a form that relates submissions to entries. I have a page that lists many entries and pulls all the submissions for each of those looped entries. It works but the db calls can get extremely large. I am using this code and the freefrom part directly from the docs to get the submissions:
It only works if I don't eager load "notifications" using a "with" which results in many more db calls. I'd like to be able to eager load something like
but I get the error
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Sorry for the delay @AbbeyDesign... In our testing, we cannot reproduce this as an issue. The DB query count does not change if accessing the submissions using the {% set entries = craft.entries.with('subs').all() %}
{% for entry in entries %}
<p>
{{ entry.title }}
{% for sub in entry.subs.all() %}
<li>{{ sub.title }}</li>
{% endfor %}
</p>
{% endfor %} |
Beta Was this translation helpful? Give feedback.
Sorry for the delay @AbbeyDesign...
In our testing, we cannot reproduce this as an issue. The DB query count does not change if accessing the submissions using the
.with('subs')
. Without it, the query count about doubles. 🙂