Exemple #1
0
 /**
  * Updates config item value.
  * 
  * @param string $key
  * @param string $name
  * @param mixed $value
  * @throws InvalidArgumentException
  */
 public function saveConfig($key, $name, $value)
 {
     $config = $this->configDao->findConfig($key, $name);
     if ($config === null) {
         throw new InvalidArgumentException("Can't find config `" . $name . "` in section `" . $key . "`!");
     }
     $this->configDao->save($config->setValue($value));
 }
Exemple #2
0
 /**
  * Updates config item value.
  * 
  * @param string $key
  * @param string $name
  * @param mixed $value
  * @throws InvalidArgumentException
  */
 public function saveConfig($key, $name, $value)
 {
     $config = $this->configDao->findConfig($key, $name);
     if ($config === null) {
         throw new InvalidArgumentException("Can't find config `" . $name . "` in section `" . $key . "`!");
     }
     $event = OW::getEventManager()->trigger(new OW_Event(self::EVENT_BEFORE_SAVE, array("key" => $key, "name" => $name, "value" => $value, "oldValue" => $config->getValue()), $value));
     $this->configDao->save($config->setValue($event->getData()));
     OW::getEventManager()->trigger(new OW_Event(self::EVENT_AFTER_SAVE, array("key" => $key, "name" => $name, "value" => $value, "oldValue" => $config->getValue())));
 }