I have a entity, User
and User can has many phone number, so I have field: User.numbers
and entity Number
UserType:
->add('numbers', CollectionType::class, array(
'entry_type' => NumberType::class,
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true,
))
Field number also uses @Gedmo\SoftDeleteable
. It works Ok - when I'm deleting phone number directly it's Ok, phone number wont be deleted, only marked as deleted.
But If I update User and I have 5 numbers, I delete one and send form with only 4 - entity manager ignores soft delete and deletes it anyway.
Is it possible to work with orphan removal and softdeleteable together?
When soft deleteable filter is disabled, it doesn't mean that listener is disabled.
Consider extendin base listener class:
Then, call
$entityManager->getFilters()->disable('softdeleteable');
before the logic you want to happen with hard delete.