예제 #1
0
 public function save(Default_Model_APIKey $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getKey())) {
         $data['key'] = $value->getKey();
     }
     if (!isnull($value->getAuthMethods())) {
         $data['authmethods'] = $value->getAuthMethods();
     }
     if (!isnull($value->getOwnerID())) {
         $data['ownerid'] = $value->getOwnerID();
     }
     if (!isnull($value->getCreatedOn())) {
         $data['createdon'] = $value->getCreatedOn();
     }
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getSysAccountID())) {
         $data['sysaccountid'] = $value->getSysAccountID();
     }
     $q1 = 'id = ?';
     $q2 = $value->id;
     if (null === ($id = $value->id)) {
         unset($data['id']);
         $value->id = $this->getDbTable()->insert($data);
     } else {
         $s = $this->getDbTable()->getAdapter()->quoteInto($q1, $q2);
         $this->getDbTable()->update($data, $s);
     }
 }