/** * Used by the {@link save()} method to insert a new object * * @see save * @access protected */ protected function insert($replace = false) { $query = $this->getInsertQuery(); $this->setInsertQueryValues($query); if ($replace) { $query->replace(); } $query->doQuery(); if ($auto_key = $this->table()->autoKeyField()) { $this->table->setFieldValue($auto_key->name(), $query->autoKey()); } $this->clearQueryCache(); $this->requires_insert = false; }