/** * saves a record with a auto increment primary key which means if the key is null * it will be inserted and if a key exists it will be updated * * @return bool|object * @throws EQMException */ public function save() { $tableMeta = EQM::tableMeta(get_class($this)); if ($tableMeta->hasAutoIncrement()) { if (empty($this->{$tableMeta->getAutoIncrement()})) { return $this->insert(); } else { return $this->update(); } } else { throw new EQMException('save() is not possible for entities without auto increment primary key', 10001); } }