Skip to content

findBy from ServiceEntityRepository returning proxies depends if i use orderBy #11828

Discussion options

You must be logged in to vote

One thing that could explain the usage of proxies for a different ordering might be that you have a self-referencing association in your entity (not visible in your code snippet). In this case, if your entities are only referencing entities created before them, a sort by creation date will mean that the hydration of each entity never needs to create a proxy because the related entity has already been hydrated for a previous item in the list. With a different ordering (or a sorting by descending creation date) would instead have cases where hydrating an invoice involves a related entity that is not hydrated yet (which then creates a proxy for it), even if another result item corresponds to…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@oriolvinals
Comment options

@stof
Comment options

stof Feb 7, 2025
Maintainer

Answer selected by oriolvinals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants