public function save(Repository_Model_MetaPoaReleasePackage $value) { global $application; $data = array(); if (!isnull($value->getId())) { $data['id'] = $value->getId(); } if (!isnull($value->getPoaId())) { $data['poaId'] = $value->getPoaId(); } if (!isnull($value->getPkgName())) { $data['pkgName'] = $value->getPkgName(); } if (!isnull($value->getPkgVersion())) { $data['pkgVersion'] = $value->getPkgVersion(); } if (!isnull($value->getPkgRelease())) { $data['pkgRelease'] = $value->getPkgRelease(); } if (!isnull($value->getPkgArch())) { $data['pkgArch'] = $value->getPkgArch(); } if (!isnull($value->getPkgType())) { $data['pkgType'] = $value->getPkgType(); } if (!isnull($value->getPkgFilename())) { $data['pkgFilename'] = $value->getPkgFilename(); } if (!isnull($value->getPkgDescription())) { $data['pkgDescription'] = $value->getPkgDescription(); } if (!isnull($value->getPkgInstallationSize())) { $data['pkgInstallationSize'] = $value->getPkgInstallationSize(); } if (!isnull($value->getPkgGroup())) { $data['pkgGroup'] = $value->getPkgGroup(); } if (!isnull($value->getPkgRequires())) { $data['pkgRequires'] = $value->getPkgRequires(); } if (!isnull($value->getPkgLicense())) { $data['pkgLicense'] = $value->getPkgLicense(); } if (!isnull($value->getPkgUrl())) { $data['pkgUrl'] = $value->getPkgUrl(); } if (!isnull($value->getPkgGeneral())) { $data['pkgGeneral'] = $value->getPkgGeneral(); } if (!isnull($value->getPkgMisc())) { $data['pkgMisc'] = $value->getPkgMisc(); } if (!isnull($value->getPkgLevel())) { $data['pkgLevel'] = $value->getPkgLevel(); } if (!isnull($value->getPkgSize())) { $data['pkgSize'] = $value->getPkgSize(); } if (!isnull($value->getPkgMd5Sum())) { $data['pkgMd5Sum'] = $value->getPkgMd5Sum(); } if (!isnull($value->getPkgSha1Sum())) { $data['pkgSha1Sum'] = $value->getPkgSha1Sum(); } if (!isnull($value->getPkgSha256Sum())) { $data['pkgSha256Sum'] = $value->getPkgSha256Sum(); } if (!isnull($value->getPkgVersionIndex())) { $data['pkgVersionIndex'] = $value->getPkgVersionIndex(); } if (!isnull($value->getTimestampInserted())) { $data['timestampInserted'] = $value->getTimestampInserted(); } 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); } }
public static function createPoaPackage($poa, $info, $userid, &$output) { $poaid = is_numeric($poa) ? $poa : $poa->id; try { $pkg = new Repository_Model_MetaPoaReleasePackage(); $pkg->poaId = $poaid; $pkg->pkgName = $info["name"]; $pkg->pkgVersion = $info["version"]; $pkg->pkgRelease = $info["release"]; $pkg->pkgArch = $info["architecture"]; $pkg->pkgType = $info["type"]; $pkg->pkgFilename = $info["filename"]; $pkg->pkgDescription = $info["description"]; $pkg->pkgInstallationsize = isset($info["installationsize"]) ? $info["installationsize"] : ""; $pkg->pkgGroup = isset($info["group"]) ? $info["group"] : ""; $pkg->pkgRequires = isset($info["depends"]) ? $info["depends"] : ""; $pkg->pkgLicense = isset($info["license"]) ? $info["license"] : ""; $pkg->pkgUrl = isset($info["url"]) ? $info["url"] : ""; $pkg->pkgSize = $info["size"]; $pkg->pkgMd5Sum = $info["md5sum"]; $pkg->pkgSha1Sum = $info["sha1sum"]; $pkg->pkgSha256Sum = $info["sha256sum"]; //$pkg->pkgUrl = $info["url"]; $pkg->insertedBy = $userid; $pkg->save(); } catch (Exception $e) { $output = $e->getMessage(); return false; } $pkgs = new Repository_Model_MetaPoaReleasePackages(); $pkgs->filter->id->equals($pkg->id); if (count($pkgs) === 0) { $output = "Could not retrieve new package release"; return false; } return $pkg; }