mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-343: Make it possible to force reloading of instanciated models #424
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Feb 16, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user @lsmith77:
When doing bulk UPDATE/DELETE it might be useful to tell the EntityManager to either mark a model instance as "dirty" or even force immediate reload.
So for example:
In the same vain I might want to do similar things after bulk deleting.
Furthermore in some cases I might do inserts which could mean that a collection is no longer "valid". imagine for example i insert a new record and i have a hydrated collection over all of the models in the DB.
@doctrinebot commented on GitHub (Feb 16, 2010):
Comment created by @beberlei:
Since UPDATE and DELETE only allow WHERE clauses i guess it could be possible to pass a query hint that additionally generates a SELECT query and executes it right after the update/delete statement, in combination with HINT_REFRESH.
@doctrinebot commented on GitHub (Feb 16, 2010):
Comment created by @beberlei:
@Lukas:
You can do it already, say you have:
Just execute afterwards with $query->setHint(Query::HINT_REFRESH, true);
@doctrinebot commented on GitHub (Feb 16, 2010):
Comment created by @lsmith77:
awesome! but it would also be nice to just mark as dirty. after all you may not be sure that you will actually need the updated versions in the current request or not.
@doctrinebot commented on GitHub (Feb 16, 2010):
Comment created by @beberlei:
The problem is, UPDATE an dDELETE are directly translated into SQL. How do you know from there which objects to mark as dirty?
@doctrinebot commented on GitHub (Feb 16, 2010):
Comment created by @lsmith77:
that would need to be custom user logic. i would tell the entitymanager to either mark all instances of a model type or only those with a specific list of id's.
@doctrinebot commented on GitHub (Feb 26, 2010):
Comment created by @beberlei:
Hm, rethinking is - there isnt really a marking "dirty" possibility for entities, since you would have them throw exceptions upon access or something like this.
The underlying issue of this ticket is "fixed" though. Marking closed.
@doctrinebot commented on GitHub (Feb 26, 2010):
Issue was closed with resolution "Fixed"