/** @throws PntError */ function save() { $qh= $this->newQueryHandler(); $clsDesc = $this->getClassDescriptor(); $tableMap = $clsDesc->getTableMap(); $insert = $this->isNew(); reset($tableMap); foreach ($tableMap as $tableName => $ignoored) { $fieldMap = $clsDesc->getFieldMapForTable($tableName); if ($insert || count($fieldMap) > 1) $qh->setQueryToSaveObject_table_fieldMap($this , $tableName, $fieldMap, $insert); $qh->runQuery(null, $this->getClass()." saving has failed"); if ($this->isNew()) { $this->id = $qh->getInsertId(); $clsDesc->peanutInserted($this); //adds this to the cache } } } |