I'm using DoctrineExtensions with StofDoctrineExtensionsBundle to get the soft-deleteable behaviour.
It works really well in the frontend of my application.
In the backend i need the option to "hard" delete entities.
I have disabled the filter in my admin controllers (i use SonataAdmin):
$filters = $this->getModelManager()->getEntityManager($this->getClass())->getFilters();
if (array_key_exists('softdeleteable', $filters->getEnabledFilters())) {
$filters->disable('softdeleteable');
}
This works (soft deleted entities show up in the lists), but when i try to delete it, the entity does get soft-deleted again. How can i force a "hard" delete?
Not the most graceful way : you always can do a real delete with SQL, it will bypass softdeletable
$em->createQuery("DELETE MyEntity e WHERE e = :et")->setParameter('et',$entity)->execute();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With