mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Imcomprehensive behaviour with doctrine postRemove events. #6699
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 @acantepie on GitHub (Apr 19, 2021).
Hi,
Using doctrine/orm 2.8.4 (got same issue with all 2.8.x tags)
I have an entity :
Somewhere on code, i have following code :
$this->em->remove($file);If i dump my entity, before call
$this->em->remove(...);, i got :I have an EventSubscriberInterface listening on 'postRemove' events:
At runtime got an exception at line
$entity->configName:request.CRITICAL: Uncaught PHP Exception ErrorException: "Warning: Undefined array key "id"" at /home/acantepie/projects/umbrella-admin-demo/vendor/doctrine/orm/lib/Doctrine/ORM/Utility/IdentifierFlattener.php line 94 {"exception":"[object] (ErrorException(code: 0): Warning: Undefined array key \"id\" at /home/acantepie/projects/umbrella-admin-demo/vendor/doctrine/orm/lib/Doctrine/ORM/Utility/IdentifierFlattener.php:94)"} []I can resolve issue if i force orm to initialize entity :
@greg0ire commented on GitHub (Apr 20, 2021):
From the docs:
This sounds a bit like what is happening to you, doesn't it?
@acantepie commented on GitHub (Apr 20, 2021):
Indeed, but excption isn't comprehensive.
@greg0ire commented on GitHub (Apr 20, 2021):
Careful, "comprehensive" is a faux-ami . But you are right, there could be better DX here.