public function save(Default_Model_Dataset $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getName())) {
         $data['name'] = $value->getName();
     }
     if (!isnull($value->getCategory())) {
         $data['category'] = $value->getCategory();
     }
     if (!isnull($value->getDescription())) {
         $data['description'] = $value->getDescription();
     }
     if (!isnull($value->getHomepage())) {
         $data['homepage'] = $value->getHomepage();
     }
     if (!isnull($value->getElixirURL())) {
         $data['elixir_url'] = $value->getElixirURL();
     }
     if (!isnull($value->getDisciplineID())) {
         $data['disciplineid'] = $value->getDisciplineID();
     }
     if (!isnull($value->getAddedByID())) {
         $data['addedby'] = $value->getAddedByID();
     }
     if (!isnull($value->getAddedon())) {
         $data['addedon'] = $value->getAddedon();
     }
     if (!isnull($value->getTags())) {
         $data['tags'] = $value->getTags();
     }
     if (!isnull($value->getGuID())) {
         $data['guid'] = $value->getGuID();
     }
     $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);
     }
 }
Beispiel #2
0
 public function save(Default_Model_Dataset $value)
 {
     $oldTags = $value->tags;
     if (!is_array($value->tags) || count($value->tags) == 0 || trim($value->tags[0]) == "") {
         $value->setTags("NULL");
     } else {
         $value->setTags(php_to_pg_array($value->tags));
     }
     //		parent::save($value);
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getName())) {
         $data['name'] = $value->getName();
     }
     if (!isnull($value->getCategory())) {
         $data['category'] = $value->getCategory();
     }
     if (!isnull($value->getDescription())) {
         $data['description'] = $value->getDescription();
     }
     if (!isnull($value->getHomepage())) {
         $data['homepage'] = $value->getHomepage();
     }
     if (!isnull($value->getElixirURL())) {
         $data['elixir_url'] = $value->getElixirURL();
     }
     if (!isnull($value->getDisciplineID())) {
         $data['disciplineid'] = $value->getDisciplineID();
     }
     if (!isnull($value->getAddedByID())) {
         $data['addedby'] = $value->getAddedByID();
     }
     if (!isnull($value->getAddedon())) {
         $data['addedon'] = $value->getAddedon();
     }
     if (!isnull($value->getTags())) {
         $data['tags'] = $value->getTags();
     }
     if (!isnull($value->getGuID())) {
         $data['guid'] = $value->getGuID();
     }
     if (!isnull($value->getParentID())) {
         $data['parentid'] = $value->getParentID();
     }
     if ($value->getParentID() == "0") {
         $data['parentid'] = null;
     }
     if (trim($value->getHomepage()) === "") {
         $data['homepage'] = null;
     }
     if (trim($value->getElixirURL()) === "") {
         $data['elixir_url'] = null;
     }
     if (trim($value->getDescription()) === "") {
         $data['description'] = null;
     }
     if ($value->getTags() === "NULL") {
         $data['tags'] = null;
     }
     $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);
     }
     $value->setTags($oldTags);
 }