Replies: 1 comment 1 reply
-
This sounds like a performance issue - it's very possible it's not something you're doing wrong. Would you be able to share an example repository so I can take a look? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I stumbled on to a slight issue when using belongsTo field on Runway. I have an Eloquent query on Laravel model (screenings) and based on that result I filter down Statamic entries query (pages). After these I map over the screenings collection, where I once again filter the pages entries collection and combine the two together.
The relations between Entries and Laravel models are as following:
pages.movieid (belongsTo) - movie.id - screening.movieid
So the common thing is
movieid
.If I have the relation as an integer field
movieid
, full page load is around 500ms. If I change the relation into belongsTo field, full page load takes 4000ms. By changing the field from integer to belongsTo increases database queries quite a lot. This all happens inside the collection map.Technically, in this situation, I'm not interested about the pages belongsTo relation but only the raw value of that field. If I look at it in database, I see that the value is the same in bot cases (integer and belongsTo). Is there a way to use this raw value without triggering lazy loading inside map? I probably could do also with eager loading outside map.
This might be something that's already possible with Statamic, but I've not found a way yet.
Beta Was this translation helpful? Give feedback.
All reactions