public function deleteTasks($data = null) {
		if (empty($data) || !is_array($data)) {
			return false;
		}

		$excludeFields = [
			'data',
			'failure_message',
			'workerkey',
		];
		$data = array_diff_key($data, array_flip($excludeFields));
		$conditions = [];
		foreach ($data as $field => $value) {
			$conditions[$this->alias . '.' . $field] = $value;
		}

		if (empty($conditions)) {
			return false;
		}

		$countTasks = $this->find('count', compact('conditions'));
		if (($countTasks == 0) || !$this->deleteAll($conditions)) {
			return false;
		}

		return true;
	}
public function deleteTasks($data = null) {
		if (empty($data) || !is_array($data)) {
			return false;
		}

		$excludeFields = [
			'data',
			'failure_message',
			'workerkey',
		];
		$data = array_diff_key($data, array_flip($excludeFields));
		$conditions = [];
		foreach ($data as $field => $value) {
			$conditions[$this->alias . '.' . $field] = $value;
		}

		if (empty($conditions)) {
			return false;
		}

		$countTasks = $this->find('count', compact('conditions'));
		if (($countTasks == 0) || !$this->deleteAll($conditions)) {
			return false;
		}

		return true;
	}
public function deleteTasks ( $ data = null ) { if ( empty ( $ data ) || ! is_array ( $ data ) ) { return false ; } $ excludeFields = [ 'data' , 'failure_message' , 'workerkey' , ] ; $ data = array_diff_key ( $ data , array_flip ( $ excludeFields ) ) ; $ conditions = [ ] ; foreach ( $ data as $ field => $ value ) { $ conditions [ $ this -> alias . '.' . $ field ] = $ value ; } if ( empty ( $ conditions ) ) { return false ; } $ countTasks = $ this -> find ( 'count' , compact ( 'conditions' ) ) ; if ( ( $ countTasks == 0 ) || ! $ this -> deleteAll ( $ conditions ) ) { return false ; } return true ; }
Delete tasks by fields value

@param array $data Data of task for deleting
@return bool Success
Delete tasks by fields value