Custom module: select all entries from section with Entry::find() extremely slow/not working #11512
Replies: 2 comments 2 replies
-
You are running in an endless loop because you call this function inside your fields When you execute an ElementQuery while Craft isn't fully bootstrapped it tries to grab all fields in order to append all For the sake of performance and best practice you should not fetch all entries unless they are really required... keep in mind otherwise EVERY single request will fetch all entries of this section. |
Beta Was this translation helpful? Give feedback.
-
Thanks for pointing me in the right direction. If you don't mind me asking, in your opinion, what would be the correct way to populate my dropdown with the entries from the |
Beta Was this translation helpful? Give feedback.
-
I am trying to create a custom module where I fill a dropbox with all entries from a specific section (which currently holds 1 entry) using the following code:
However, adding
->all()
to the entry class takes forever and yields a502 bad gateway
error. If I do the same in a twig template using e.g.{% for entry in craft.entries.section('colorThemes').all() %}
it works fine and fast.Any hints on what it is I am missing here. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions