-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
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 to find() 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.