public function save(Repository_Model_MetaProductRepoArea $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getName())) {
         $data['name'] = $value->getName();
     }
     if (!isnull($value->getSwId())) {
         $data['swId'] = $value->getSwId();
     }
     if (!isnull($value->getSwName())) {
         $data['swName'] = $value->getSwName();
     }
     if (!isnull($value->getDescription())) {
         $data['description'] = $value->getDescription();
     }
     if (!isnull($value->getInstallationNotes())) {
         $data['installationNotes'] = $value->getInstallationNotes();
     }
     if (!isnull($value->getAdditionalDetails())) {
         $data['additionalDetails'] = $value->getAdditionalDetails();
     }
     if (!isnull($value->getYumRepofileId())) {
         $data['yumRepofileId'] = $value->getYumRepofileId();
     }
     if (!isnull($value->getAptRepofileId())) {
         $data['aptRepofileId'] = $value->getAptRepofileId();
     }
     if (!isnull($value->getKnownIssues())) {
         $data['knownIssues'] = $value->getKnownIssues();
     }
     if (!isnull($value->getTimestampInserted())) {
         $data['timestampInserted'] = $value->getTimestampInserted();
     }
     if (!isnull($value->getTimestampLastUpdated())) {
         $data['timestampLastUpdated'] = $value->getTimestampLastUpdated();
     }
     if (!isnull($value->getTimestampLastProductionBuild())) {
         $data['timestampLastProductionBuild'] = $value->getTimestampLastProductionBuild();
     }
     if (!isnull($value->getInsertedBy())) {
         $data['insertedBy'] = $value->getInsertedBy();
     }
     $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);
     }
 }
Ejemplo n.º 2
0
 public static function createRepositoryArea($name, $swid, $swname, $userid = 0)
 {
     if (trim($name) === "") {
         return false;
     }
     if (!$swid || is_numeric($swid) === false) {
         return false;
     }
     $rarea = self::getRepositoryAreaByNameSw($name, $swid);
     if ($rarea === false) {
         //ignore new software names
         $sw_name = self::getRepositoryAreaSWName($swid);
         if ($sw_name === false) {
             $sw_name = $swname;
         }
         $rarea = new Repository_Model_MetaProductRepoArea();
         $rarea->name = $name;
         $rarea->swId = $swid;
         $rarea->swName = $sw_name;
         $rarea->insertedBy = $userid;
         $rarea->save();
     }
     $rarea = self::getRepositoryAreaByNameSw($name, $swid);
     $rareaid = $rarea->id;
     if (is_numeric($rareaid) == true && is_numeric($userid) === true && $userid !== 0) {
         Repository::addRepoAreaByExternalId($rareaid, $userid, "1");
         Repository::addRepoAreaByExternalId($rareaid, $userid, "2");
     }
     return $rareaid;
 }