private function updateSetting($param, $value) { $c = new Criteria(); $c->add(EtvaSettingPeer::PARAM, $param); $obj = EtvaSettingPeer::doSelectOne($c); if ($obj === null) { $obj = new EtvaSetting(); $obj->setParam($param); } $obj->setValue($value); $obj->save(); }
public function saveSettings($sn, $user, $pwd, $desc) { $this->serial_number = $sn; $pk = 'serial_number'; $sn_setting = EtvaSettingPeer::retrieveByPk($pk); if (!$sn_setting) { $sn_setting = new EtvaSetting(); } $sn_setting->setParam($pk); $sn_setting->setValue($this->serial_number); $sn_setting->save(); $this->username = $user; $pk = 'username'; $user_setting = EtvaSettingPeer::retrieveByPk($pk); if (!$user_setting) { $user_setting = new EtvaSetting(); } $user_setting->setParam($pk); $user_setting->setValue($this->username); $user_setting->save(); $this->password = $pwd; $pk = 'password'; $pwd_setting = EtvaSettingPeer::retrieveByPk($pk); if (!$pwd_setting) { $pwd_setting = new EtvaSetting(); } $pwd_setting->setParam($pk); $pwd_setting->setValue($this->password); $pwd_setting->save(); $this->description = $desc; $pk = 'description'; $desc_setting = EtvaSettingPeer::retrieveByPk($pk); if (!$desc_setting) { $desc_setting = new EtvaSetting(); } $desc_setting->setParam($pk); $desc_setting->setValue($this->description); $desc_setting->save(); }