예제 #1
0
 public function save(Default_Model_Funding $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getIdentifier())) {
         $data['identifier'] = $value->getIdentifier();
     }
     if (!isnull($value->getName())) {
         $data['name'] = $value->getName();
     }
     if (!isnull($value->getDescription())) {
         $data['description'] = $value->getDescription();
     }
     if (!isnull($value->getParentID())) {
         $data['parentid'] = $value->getParentID();
     }
     $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);
     }
 }
예제 #2
0
 private static function importFunding($data, $parentid = null)
 {
     $f = self::isFundingImported($data["identifier"]);
     if ($f !== null) {
         return $f;
     }
     $f = new Default_Model_Funding();
     $f->name = $data["name"];
     $f->description = $data["description"];
     $f->identifier = $data["identifier"];
     $f->parentid = $parentid;
     $f->save();
     return self::isFundingImported($data["identifier"]);
 }