How to disable soft delete (Soft-deleteable) filter for doctrine in symfony

前端 未结 4 1679
梦如初夏
梦如初夏 2021-02-19 15:55

Installing and using SoftDeleteable behavior extension for Doctrine 2 is quite easy. The problem usually is trying to disable it for some code part and enabling again. You may w

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-19 16:09

    Just a small reminder.

    When you want to hard delete entity with Gedmo Softdeletable you have to have hardDelete=true in the respective annotation, see:

    @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)

    EDIT: hardDelete=true is true by default

    With this, you dont have to disable the listener/filter. If you have hardDelete=false, the double remove suggested above will not work.

    Source:

    • https://github.com/Atlantic18/DoctrineExtensions/blob/v2.4.x/doc/softdeleteable.md

提交回复
热议问题