SoftDeleteable Filter

Edit this page

SoftDeleteable Filter

If you want to use the SoftDeleteable behavior, you have to enable the Doctrine filter.

1
2
3
4
5
6
7
8
9
10
# app/config/config.yml
# (or config/packages/doctrine.yaml if you use Flex)
doctrine:
    orm:
        entity_managers:
            default:
                filters:
                    softdeleteable:
                        class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
                        enabled: true

Note

If you are using the short syntax for the ORM configuration, the filters key is directly under orm:

Note

If you are using several entity managers, take care to register the filter for the right ones.

To disable the behavior, e.g. for admin users who may see deleted items, disable the filter. Here is an example:

1
2
$filters = $em->getFilters();
$filters->disable('softdeleteable');
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.