-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetching untracked entities #8429
Comments
Just out of curiosity, do you think modifying the change tracking policy for the entities would help in your use case or would this still be problematic because these entities will likely not be picked up by garbage collection? |
our main concern is indeed garbage collection, as we process a lot of data to create a new entry. i am not too familiar with the change tracking policy, but from the name of it assume i could tell to not track changes on some entity. that seems not to match our use case, and i could probably clone the entity to get the same effect? (except maybe for relations that are loaded as proxy only at the time of cloning) |
my own use case for that is a case where I deal with my entities in a read-only way for a processing, but dealing with a big number of such entities (using Today, I deal with that with I think that to be safe, we might need to reuse existing entries of the identity map if the fetching involves some objects which are already fetched (especially regarding |
Detach might be undeprecated |
Undeprecating it would be fine with me. Maybe documenting it as an advanced topic. |
In #7901, detaching entities has been deprecated. There are use cases where having untracked "entities" would be very useful though. In our case, we have a system that reads various entities and then creates or updates an entity (of a different type). We know that the entities we read will not (or even must not) be changed. And we would be glad to be able to leave those objects up for garbage collection. @stof mentions a similar issue in the discussion on the deprecation merge request.
I can see that the general
detach
is very fragile and can lead to weird issues. But we know we don't want to entity to be tracked when we fetch it from a repository/entity manager. Could we make a query hint that does dehydrate to the object but not add it to the identity map? Plus a way tofind()
without tracking (probably a separate method - find does not take query hints)?@thePanz and me would have some time to work on this if we can agree on the need for this and an architecture for it.
The text was updated successfully, but these errors were encountered: