src/Ubiquity/controllers/crud/CRUDControllerUtilitiesTrait.php
protected function _deleteMultiple($data, $action, $target, $condition) {
		if (URequest::isPost ()) {
			if (is_callable ( $condition )) {
				$condition = $condition ( $data );
			}
			$rep = DAO::deleteAll ( $this->model, $condition );
			if ($rep) {
				$message = new CRUDMessage ( "Deleting {count} objects", "Deletion", "info", "info circle", 4000 );
				$message = $this->_getEvents ()->onSuccessDeleteMultipleMessage ( $message, $rep );
				$message->parseContent ( [ "count" => $rep ] );
			}
			if (isset ( $message )) {
				$this->_showSimpleMessage ( $message, "delete-all" );
			}
			$this->index ();
		} else {
			$message = new CRUDMessage ( "Do you confirm the deletion of this objects?", "Remove confirmation", "error" );
			$this->_getEvents ()->onConfDeleteMultipleMessage ( $message, $data );
			$message = $this->_showConfMessage ( $message, $this->_getBaseRoute () . "/{$action}/{$data}", $target, $data, [ "jqueryDone" => "replaceWith" ] );
			echo $message;
			echo $this->jquery->compile ( $this->view );
		}
	}
protected function _deleteMultiple($data, $action, $target, $condition) {
		if (URequest::isPost ()) {
			if (is_callable ( $condition )) {
				$condition = $condition ( $data );
			}
			$rep = DAO::deleteAll ( $this->model, $condition );
			if ($rep) {
				$message = new CRUDMessage ( "Deleting {count} objects", "Deletion", "info", "info circle", 4000 );
				$message = $this->_getEvents ()->onSuccessDeleteMultipleMessage ( $message, $rep );
				$message->parseContent ( [ "count" => $rep ] );
			}
			if (isset ( $message )) {
				$this->_showSimpleMessage ( $message, "delete-all" );
			}
			$this->index ();
		} else {
			$message = new CRUDMessage ( "Do you confirm the deletion of this objects?", "Remove confirmation", "error" );
			$this->_getEvents ()->onConfDeleteMultipleMessage ( $message, $data );
			$message = $this->_showConfMessage ( $message, $this->_getBaseRoute () . "/{$action}/{$data}", $target, $data, [ "jqueryDone" => "replaceWith" ] );
			echo $message;
			echo $this->jquery->compile ( $this->view );
		}
	}
protected function _deleteMultiple ( $ data , $ action , $ target , $ condition ) { if ( URequest :: isPost ( ) ) { if ( is_callable ( $ condition ) ) { $ condition = $ condition ( $ data ) ; } $ rep = DAO :: deleteAll ( $ this -> model , $ condition ) ; if ( $ rep ) { $ message = new CRUDMessage ( "Deleting {count} objects" , "Deletion" , "info" , "info circle" , 4000 ) ; $ message = $ this -> _getEvents ( ) -> onSuccessDeleteMultipleMessage ( $ message , $ rep ) ; $ message -> parseContent ( [ "count" => $ rep ] ) ; } if ( isset ( $ message ) ) { $ this -> _showSimpleMessage ( $ message , "delete-all" ) ; } $ this -> index ( ) ; } else { $ message = new CRUDMessage ( "Do you confirm the deletion of this objects?" , "Remove confirmation" , "error" ) ; $ this -> _getEvents ( ) -> onConfDeleteMultipleMessage ( $ message , $ data ) ; $ message = $ this -> _showConfMessage ( $ message , $ this -> _getBaseRoute ( ) . "/{$action}/{$data}" , $ target , $ data , [ "jqueryDone" => "replaceWith" ] ) ; echo $ message ; echo $ this -> jquery -> compile ( $ this -> view ) ; } }
Helper to delete multiple objects

@param mixed $data
@param string $action
@param string $target the css selector for refreshing
@param callable|string $condition the callback for generating the SQL where (for deletion) with the parameter data, or a simple string
Helper to delete multiple objects