/** * @inheritdoc */ public function insert($table, $columns) { if ($table != '{{%auth_item}}' || !isset($columns['name'])) { return parent::insert($table, $columns); } $item = (new \yii\db\Query())->from($table)->where(['name' => $columns['name']])->exists(); if (!$item) { return parent::insert($table, $columns); } }
/** * @inheritdoc * Note: table will be auto pefixied if [[$autoWrapTableNames]] is true. */ public function insert($table, $columns) { $table = $this->autoWrappedTableName($table); return parent::insert($table, $columns); }
public function insert($table, $columns) { parent::insert($table, $columns); return $this->db->getLastInsertID(); }