mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Cannot remove SINGLE_TABLE inheritance entity on postFlush event. #5447
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 @matt-halliday on GitHub (Mar 10, 2017).
Not really sure what's going on here. I am cleaning up duplicate entities on postFlush in Symfony 3.2 using Orm v2.5.6. and all is well until I try to remove an entity that uses inheritance. The mapping for the joinTables is null.
An explanation I've posted to stack overflow:
I have a
postFlushevent subscriber/listener in a Symfony3 project that checks for existing items in the database from a collection, if it finds a match, it reassigns the existing entity to theDocumentand removes the new one usingorphanRemoval=true. The code is working forTaghowever when I try to do the same with an entity using inheritance mappingTool, I get an error:I have a
Tooland aPartwhich share a common table/structureEquipmentas aManyToManyrelationship to aDocument. They share a common structure and use SINGLE_TABLE inheritance with adiscrfield.My
Documententity:My little
Toolentity:Equipmentabstract entity:Here's the listener code:
Is there a reason why the mapping is being lost when we try to remove the orphaned
Tool? When Ivar_dump($joinColumns)on line 526 inBasicEntityPersister.phpit returns null.Full stack trace: