protected function prepareUpdateSets($table, $columns, $params = [])
    {
        $tableSchema = $this->db->getSchema()->getTableSchema($table);
        $columnSchemas = $tableSchema !== null ? $tableSchema->columns : [];
        $sets = [];
        foreach ($columns as $name => $value) {

            $value = isset($columnSchemas[$name]) ? $columnSchemas[$name]->dbTypecast($value) : $value;
            if ($value instanceof ExpressionInterface) {
                $placeholder = $this->buildExpression($value, $params);
            } else {
                $placeholder = $this->bindParam($value, $params);
            }

            $sets[] = $this->db->quoteColumnName($name) . '=' . $placeholder;
        }
        return [$sets, $params];
    }
protected function prepareUpdateSets($table, $columns, $params = [])
    {
        $tableSchema = $this->db->getSchema()->getTableSchema($table);
        $columnSchemas = $tableSchema !== null ? $tableSchema->columns : [];
        $sets = [];
        foreach ($columns as $name => $value) {

            $value = isset($columnSchemas[$name]) ? $columnSchemas[$name]->dbTypecast($value) : $value;
            if ($value instanceof ExpressionInterface) {
                $placeholder = $this->buildExpression($value, $params);
            } else {
                $placeholder = $this->bindParam($value, $params);
            }

            $sets[] = $this->db->quoteColumnName($name) . '=' . $placeholder;
        }
        return [$sets, $params];
    }
protected function prepareUpdateSets ( $ table , $ columns , $ params = [ ] ) { $ tableSchema = $ this -> db -> getSchema ( ) -> getTableSchema ( $ table ) ; $ columnSchemas = $ tableSchema !== null ? $ tableSchema -> columns : [ ] ; $ sets = [ ] ; foreach ( $ columns as $ name => $ value ) { $ value = isset ( $ columnSchemas [ $ name ] ) ? $ columnSchemas [ $ name ] -> dbTypecast ( $ value ) : $ value ; if ( $ value instanceof ExpressionInterface ) { $ placeholder = $ this -> buildExpression ( $ value , $ params ) ; } else { $ placeholder = $ this -> bindParam ( $ value , $ params ) ; } $ sets [ ] = $ this -> db -> quoteColumnName ( $ name ) . '=' . $ placeholder ; } return [ $ sets , $ params ] ; }
Prepares a `SET` parts for an `UPDATE` SQL statement.
@param string $table the table to be updated.
@param array $columns the column data (name => value) to be updated.
@param array $params the binding parameters that will be modified by this method
so that they can be bound to the DB command later.
@return array an array `SET` parts for an `UPDATE` SQL statement (the first array element) and params (the second array element).
Prepares a SET parts for an UPDATE SQL statement .