Cake\ORM\Query::update PHP Méthode

update() public méthode

This changes the query type to be 'update'. Can be combined with set() and where() methods to create update queries.
public update ( string | null $table = null )
$table string | null Unused parameter.
    public function update($table = null)
    {
        $table = $table ?: $this->repository()->table();
        return parent::update($table);
    }

Usage Example

Exemple #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();
 }
All Usage Examples Of Cake\ORM\Query::update