コード例 #1
0
 public function save(Repository_Model_MetaContact $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getAssocId())) {
         $data['assocId'] = $value->getAssocId();
     }
     if (!isnull($value->getAssocEntity())) {
         $data['assocEntity'] = $value->getAssocEntity();
     }
     if (!isnull($value->getExternalId())) {
         $data['externalId'] = $value->getExternalId();
     }
     if (!isnull($value->getContactTypeId())) {
         $data['contactTypeId'] = $value->getContactTypeId();
     }
     if (!isnull($value->getFirstname())) {
         $data['firstname'] = $value->getFirstname();
     }
     if (!isnull($value->getLastname())) {
         $data['lastname'] = $value->getLastname();
     }
     if (!isnull($value->getEmail())) {
         $data['email'] = $value->getEmail();
     }
     $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);
     }
 }