public function insert($key, $value = null, $comment = '', $type = 'string') { // $aNewPath = SystemRegisterHelper::responsePath($key); // Если путь больше чем 1 if (sizeof($aNewPath) > 1) { return SystemRegisterHelper::delegate($this->aCurrentPath, $aNewPath, 'insert', array($value, $comment, $type)); } else { // Если текущий уровень - первый, то вставки и обновления запрещены $this->checkFirstLevel(); // Проверяем, что ключ уже существует $aElement = SystemRegisterSample::get($key, $this->nId); if (!empty($aElement)) { throw new SystemRegisterException('Insert failed! Element `' . $key . '` already exists'); } // Добавляем в бд return SystemRegisterSample::insert($this, $key, $value, $comment, $type); } // Всё }
/** * Сохраняет новый лист */ public function insert() { if (!empty($this->nId)) { throw new SystemRegisterException('Insert failed! Attribute $id not empty'); } SystemRegisterSample::insert($this->parent, $this->szName, $this->szValue, $this->szComment, $this->szType); }