Search code examples
phpsymfonysonata-admin

Is there anything like predelete for the batch delete in sonata Admin bundle


I'm wondring if there are pre events in sonata Admins for example: PreBatchDeleteAction() methods


Solution

  • Yes, you can use for the batchDeleteAction this method:

    public function batchActionDeleteIsRelevant(array $selectedIds, $allEntitiesSelected, Request $request = null)  
    {
    }
    

    And the generale rule witch work with any batch action is:

    batchAction<MyAction>IsRelevant(array $selectedIds, $allEntitiesSelected, Request $request = null)
    {
    }