mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3179: Non initialized Proxy object with post remove listener #3939
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 (Jun 19, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user geoffrey.brier:
Hi,
My use case is as follow:
I have an object "Demand" linked to a "Guarantor" which possesses a few files to delete from the server on the "post remove" doctrine event. The Demand -> Guarantor relation is configured to cascade persist and remove on the ORM side.
We intended to remove a "Demand" object but were getting an "EntityNotFoundException". After debugging a bit with a friend (eric geloen) we realized that when non initialized proxies have a listener on the post remove event, the object cannot loads itself as it does not exist anymore and this throws an exception. In my case, this means that I cannot delete the "Guarantor's" files.
So I was wondering if it was a bug coming from doctrine or a normal behavior. One could consider that it is our responsibility to correctly load an object and its graph yet one could also consider that this is a limitation (not to initialize the proxies beforehand).
While testing we moved the following snippet (that was in the cascadeRemove method) in the "executeDeletions" method right before the delete call and it was working.
What is your opinion?
@doctrinebot commented on GitHub (Jun 19, 2014):
@doctrinebot commented on GitHub (Jun 19, 2014):
Comment created by @ocramius:
[~geoffrey.brier] this may be a bug, but it needs a test case reproducing your exact scenario.
It would also be interesting to look at what you have so far.
Also, lowering priority.
@doctrinebot commented on GitHub (Jun 26, 2014):
Comment created by @ocramius:
Resolution in DDC-3180
@doctrinebot commented on GitHub (Jun 26, 2014):
Issue was closed with resolution "Won't Fix"