public function set($key, $value = null, $types = [])
    {
        if (empty($this->_parts['set'])) {
            $this->_parts['set'] = $this->newExpr()->setConjunction(',');
        }

        if ($this->_parts['set']->isCallable($key)) {
            $exp = $this->newExpr()->setConjunction(',');
            $this->_parts['set']->add($key($exp));

            return $this;
        }

        if (is_array($key) || $key instanceof ExpressionInterface) {
            $types = (array)$value;
            $this->_parts['set']->add($key, $types);

            return $this;
        }

        if (is_string($types) && is_string($key)) {
            $types = [$key => $types];
        }
        $this->_parts['set']->eq($key, $value, $types);

        return $this;
    }
public function set($key, $value = null, $types = [])
    {
        if (empty($this->_parts['set'])) {
            $this->_parts['set'] = $this->newExpr()->setConjunction(',');
        }

        if ($this->_parts['set']->isCallable($key)) {
            $exp = $this->newExpr()->setConjunction(',');
            $this->_parts['set']->add($key($exp));

            return $this;
        }

        if (is_array($key) || $key instanceof ExpressionInterface) {
            $types = (array)$value;
            $this->_parts['set']->add($key, $types);

            return $this;
        }

        if (is_string($types) && is_string($key)) {
            $types = [$key => $types];
        }
        $this->_parts['set']->eq($key, $value, $types);

        return $this;
    }
public function set ( $ key , $ value = null , $ types = [ ] ) { if ( empty ( $ this -> _parts [ 'set' ] ) ) { $ this -> _parts [ 'set' ] = $ this -> newExpr ( ) -> setConjunction ( ',' ) ; } if ( $ this -> _parts [ 'set' ] -> isCallable ( $ key ) ) { $ exp = $ this -> newExpr ( ) -> setConjunction ( ',' ) ; $ this -> _parts [ 'set' ] -> add ( $ key ( $ exp ) ) ; return $ this ; } if ( is_array ( $ key ) || $ key instanceof ExpressionInterface ) { $ types = ( array ) $ value ; $ this -> _parts [ 'set' ] -> add ( $ key , $ types ) ; return $ this ; } if ( is_string ( $ types ) && is_string ( $ key ) ) { $ types = [ $ key => $ types ] ; } $ this -> _parts [ 'set' ] -> eq ( $ key , $ value , $ types ) ; return $ this ; }
Set one or many fields to update.

### Examples

Passing a string:

```
$query->update('articles')->set('title', 'The Title');
```

Passing an array:

```
$query->update('articles')->set(['title' => 'The Title'], ['title' => 'string']);
```

Passing a callable:

```
$query->update('articles')->set(function ($exp) {
return $exp->eq('title', 'The title', 'string');
});
```

@param string|array|callable|\Cake\Database\Expression\QueryExpression $key The column name or array of keys
+ values to set. This can also be a QueryExpression containing a SQL fragment.
It can also be a callable, that is required to return an expression object.
@param mixed $value The value to update $key to. Can be null if $key is an
array or QueryExpression. When $key is an array, this parameter will be
used as $types instead.
@param array $types The column types to treat data as.
@return $this
Set one or many fields to update .