lib/Doctrine/DBAL/Connection.php
public function update($tableExpression, array $data, array $identifier, array $types = [])
    {
        $columns = $values = $conditions = $set = [];

        foreach ($data as $columnName => $value) {
            $columns[] = $columnName;
            $values[]  = $value;
            $set[]     = $columnName . ' = ?';
        }

        $this->addIdentifierCondition($identifier, $columns, $values, $conditions);

        if (is_string(key($types))) {
            $types = $this->extractTypeValues($columns, $types);
        }

        $sql = 'UPDATE ' . $tableExpression . ' SET ' . implode(', ', $set)
                . ' WHERE ' . implode(' AND ', $conditions);

        return $this->executeUpdate($sql, $values, $types);
    }
public function update($tableExpression, array $data, array $identifier, array $types = [])
    {
        $columns = $values = $conditions = $set = [];

        foreach ($data as $columnName => $value) {
            $columns[] = $columnName;
            $values[]  = $value;
            $set[]     = $columnName . ' = ?';
        }

        $this->addIdentifierCondition($identifier, $columns, $values, $conditions);

        if (is_string(key($types))) {
            $types = $this->extractTypeValues($columns, $types);
        }

        $sql = 'UPDATE ' . $tableExpression . ' SET ' . implode(', ', $set)
                . ' WHERE ' . implode(' AND ', $conditions);

        return $this->executeUpdate($sql, $values, $types);
    }
public function update ( $ tableExpression , array $ data , array $ identifier , array $ types = [ ] ) { $ columns = $ values = $ conditions = $ set = [ ] ; foreach ( $ data as $ columnName => $ value ) { $ columns [ ] = $ columnName ; $ values [ ] = $ value ; $ set [ ] = $ columnName . ' = ?' ; } $ this -> addIdentifierCondition ( $ identifier , $ columns , $ values , $ conditions ) ; if ( is_string ( key ( $ types ) ) ) { $ types = $ this -> extractTypeValues ( $ columns , $ types ) ; } $ sql = 'UPDATE ' . $ tableExpression . ' SET ' . implode ( ', ' , $ set ) . ' WHERE ' . implode ( ' AND ' , $ conditions ) ; return $ this -> executeUpdate ( $ sql , $ values , $ types ) ; }
Executes an SQL UPDATE statement on a table.

Table expression and columns are not escaped and are not safe for user-input.

@param string         $tableExpression The expression of the table to update quoted or unquoted.
@param mixed[]        $data            An associative array containing column-value pairs.
@param mixed[]        $identifier      The update criteria. An associative array containing column-value pairs.
@param int[]|string[] $types           Types of the merged $data and $identifier arrays in that order.

@return int The number of affected rows.

@throws DBALException
Executes an SQL UPDATE statement on a table .