Esempio n. 1
0
 /**
  * Handle a bulk toggle
  *
  * @param \Cake\ORM\Query|null $query The query to act upon
  * @return bool
  */
 protected function _bulk(Query $query = null)
 {
     $field = $this->config('field');
     $expression = [new QueryExpression(sprintf('%1$s= NOT %1$s', $field))];
     $query->update()->set($expression);
     $statement = $query->execute();
     $statement->closeCursor();
     return $statement->rowCount();
 }
Esempio n. 2
0
 /**
  * Handle a bulk value set
  *
  * @param \Cake\ORM\Query|null $query The query to act upon
  * @return bool
  */
 protected function _bulk(Query $query = null)
 {
     $field = $this->config('field');
     $value = $this->config('value');
     $query->update()->set([$field => $value]);
     $statement = $query->execute();
     $statement->closeCursor();
     return $statement->rowCount();
 }