Exemple #1
0
 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);
     }
     // Всё
 }