src/Controller/CRUDController.php
public function batchActionDelete(ProxyQueryInterface $query)
    {
        $this->admin->checkAccess('batchDelete');

        $modelManager = $this->admin->getModelManager();

        try {
            $modelManager->batchDelete($this->admin->getClass(), $query);
            $this->addFlash(
                'sonata_flash_success',
                $this->trans('flash_batch_delete_success', [], 'SonataAdminBundle')
            );
        } catch (ModelManagerException $e) {
            $this->handleModelManagerException($e);
            $this->addFlash(
                'sonata_flash_error',
                $this->trans('flash_batch_delete_error', [], 'SonataAdminBundle')
            );
        }

        return $this->redirectToList();
    }
public function batchActionDelete(ProxyQueryInterface $query)
    {
        $this->admin->checkAccess('batchDelete');

        $modelManager = $this->admin->getModelManager();

        try {
            $modelManager->batchDelete($this->admin->getClass(), $query);
            $this->addFlash(
                'sonata_flash_success',
                $this->trans('flash_batch_delete_success', [], 'SonataAdminBundle')
            );
        } catch (ModelManagerException $e) {
            $this->handleModelManagerException($e);
            $this->addFlash(
                'sonata_flash_error',
                $this->trans('flash_batch_delete_error', [], 'SonataAdminBundle')
            );
        }

        return $this->redirectToList();
    }
public function batchActionDelete ( ProxyQueryInterface $ query ) { $ this -> admin -> checkAccess ( 'batchDelete' ) ; $ modelManager = $ this -> admin -> getModelManager ( ) ; try { $ modelManager -> batchDelete ( $ this -> admin -> getClass ( ) , $ query ) ; $ this -> addFlash ( 'sonata_flash_success' , $ this -> trans ( 'flash_batch_delete_success' , [ ] , 'SonataAdminBundle' ) ) ; } catch ( ModelManagerException $ e ) { $ this -> handleModelManagerException ( $ e ) ; $ this -> addFlash ( 'sonata_flash_error' , $ this -> trans ( 'flash_batch_delete_error' , [ ] , 'SonataAdminBundle' ) ) ; } return $ this -> redirectToList ( ) ; }
Execute a batch delete.

@throws AccessDeniedException If access is not granted

@return RedirectResponse
Execute a batch delete .