public function delete(HTTPRequest $request)
    {
        $response = new HTTPBulkToolsResponse(true, $this->gridField);

        try {
            foreach ($this->getRecords() as $record) {
                $response->addSuccessRecord($record);
                $record->delete();
            }

            $doneCount = count($response->getSuccessRecords());
            $message = sprintf(
                'Deleted %1$d records.',
                $doneCount
            );
            $response->setMessage($message);
        } catch (Exception $ex) {
            $response->setStatusCode(500);
            $response->setMessage($ex->getMessage());
        }

        return $response;
    }
public function delete(HTTPRequest $request)
    {
        $response = new HTTPBulkToolsResponse(true, $this->gridField);

        try {
            foreach ($this->getRecords() as $record) {
                $response->addSuccessRecord($record);
                $record->delete();
            }

            $doneCount = count($response->getSuccessRecords());
            $message = sprintf(
                'Deleted %1$d records.',
                $doneCount
            );
            $response->setMessage($message);
        } catch (Exception $ex) {
            $response->setStatusCode(500);
            $response->setMessage($ex->getMessage());
        }

        return $response;
    }
public function delete ( HTTPRequest $ request ) { $ response = new HTTPBulkToolsResponse ( true , $ this -> gridField ) ; try { foreach ( $ this -> getRecords ( ) as $ record ) { $ response -> addSuccessRecord ( $ record ) ; $ record -> delete ( ) ; } $ doneCount = count ( $ response -> getSuccessRecords ( ) ) ; $ message = sprintf ( 'Deleted %1$d records.' , $ doneCount ) ; $ response -> setMessage ( $ message ) ; } catch ( Exception $ ex ) { $ response -> setStatusCode ( 500 ) ; $ response -> setMessage ( $ ex -> getMessage ( ) ) ; } return $ response ; }
Delete the selected records passed from the delete bulk action.

@param HTTPRequest $request

@return HTTPBulkToolsResponse
Delete the selected records passed from the delete bulk action .