I use Gedmo Doctrine Extensions , for example SoftDeletable, and at different points I need to disable this filter so that users can interact with soft remote objects or soft remote relations of an entity.
This includes, but is not limited to, once in the controller and again in a specific area of ββSonataAdmin.
So far, the solution I have found is to call getFilters () on em and disable softdeleteable, which is good.
However, both sonata classes and controllers seem to go through multiple executions, which leads to a fatal attempt to disable an already disabled filter, so I have to do this:
if (array_key_exists('softdeleteable', $this->em->getFilters()->getEnabledFilters())) { $this->em->getFilters()->disable('softdeleteable'); }
It seems to be at least hacked.
But there are also other problems, such as determining the scope of a team. I have not noticed any problems with the interface yet, but in the administrator there are several executions, one of which is to create navigation (I think), means that the filter is always disabled, and only the ability to do it directly on em seems to me that this will cause hellish load of problems as soon as I don't want the feature to be disabled somewhere in the backend.
Is there a better way to do this?
Steve
source share