Example #1
0
 public function save(Ot_Var_Abstract $var)
 {
     $model = new Ot_Model_DbTable_Config();
     $thisVar = $model->find($var->getName());
     $data = array('varName' => $var->getName(), 'value' => $var->getRawValue());
     if (is_null($thisVar)) {
         $model->insert($data);
     } else {
         $model->update($data, null);
     }
 }
Example #2
0
 public function save(Ot_Var_Abstract $var, $accountId)
 {
     $model = new Ot_Model_DbTable_AccountAttribute();
     $where = $model->getAdapter()->quoteInto('varName = ?', $var->getName()) . ' AND ' . $model->getAdapter()->quoteInto('accountId = ?', $accountId);
     $thisVar = $model->fetchAll($where);
     $data = array('accountId' => $accountId, 'varName' => $var->getName(), 'value' => $var->getRawValue());
     if ($thisVar->count() == 0) {
         $model->insert($data);
     } else {
         $model->update($data, $where);
     }
 }