You are here

protected function Model::insert in Little helpers 7.2

Same name and namespace in other branches
  1. 7 src/DB/Model.php \Drupal\little_helpers\DB\Model::insert()
1 call to Model::insert()
Model::save in src/DB/Model.php

File

src/DB/Model.php, line 54

Class

Model

Namespace

Drupal\little_helpers\DB

Code

protected function insert() {
  $cols = static::$values;
  if (!static::$serial) {
    $cols = array_merge($cols, static::$key);
  }
  $ret = db_insert(static::$table)
    ->fields($this
    ->values($cols))
    ->execute();
  if (static::$serial) {
    $this->{static::$key[0]} = $ret;
  }
}