Ouzo\Db\Query::insert PHP Метод

insert() публичный статический Метод

public static insert ( $attributes )
    public static function insert($attributes)
    {
        return Query::newInstance(QueryType::$INSERT)->attributes($attributes);
    }

Usage Example

Пример #1
0
 public function insert()
 {
     $this->_callBeforeSaveCallbacks();
     $primaryKey = $this->_modelDefinition->primaryKey;
     $attributes = $this->filterAttributesPreserveNull($this->_attributes);
     $query = Query::insert($attributes)->into($this->_modelDefinition->table);
     $lastInsertedId = QueryExecutor::prepare($this->_modelDefinition->db, $query)->insert($this->_modelDefinition->sequence);
     if ($primaryKey && $this->_modelDefinition->sequence) {
         $this->{$primaryKey} = $lastInsertedId;
     }
     $this->_callAfterSaveCallbacks();
     $this->_resetModifiedFields();
     return $lastInsertedId;
 }