Exemple #1
0
 /**
  * Adds new config item.
  * 
  * @param string $key
  * @param string $name
  * @param mixed $value
  */
 public function addConfig($key, $name, $value, $description = null)
 {
     if ($this->findConfig($key, $name) !== null) {
         throw new InvalidArgumentException("Can't add config `" . $name . "` in section `" . $key . "`. Duplicated key and name!");
     }
     $newConfig = new BOL_Config();
     $newConfig->setKey($key)->setName($name)->setValue($value)->setDescription($description);
     $this->configDao->save($newConfig);
 }
Exemple #2
0
 /**
  * Adds new config item.
  * 
  * @param string $key
  * @param string $name
  * @param mixed $value
  */
 public function addConfig($key, $name, $value, $description = null)
 {
     if ($this->findConfig($key, $name) !== null) {
         throw new InvalidArgumentException("Can't add config `" . $name . "` in section `" . $key . "`. Duplicated key and name!");
     }
     $newConfig = new BOL_Config();
     $newConfig->setKey($key)->setName($name)->setValue($value)->setDescription($description);
     $event = OW::getEventManager()->trigger(new OW_Event(self::EVENT_BEFORE_SAVE, array("key" => $key, "name" => $name, "value" => $value, "oldValue" => null), $value));
     $newConfig->setValue($event->getData());
     $this->configDao->save($newConfig);
 }