public static function createPoa($release, $target, $userid, &$output) { $targetid = is_numeric($target) ? $target : $target->id; $releaseid = is_numeric($release) ? $release : $release->id; $poa = self::getPoaByReleaseTarget($releaseid, $targetid); if ($poa === false) { $dmethods = $target->getOs()->getDeployMethods(); if (count($dmethods) === 0) { $output = "No deploy method found for " . $target->getOs()->displayName . " (" . $target->getOs()->id . ")"; return false; } $dmethodid = $dmethods[0]->id; $poa = new Repository_Model_MetaPoaRelease(); $poa->productReleaseId = $releaseid; $poa->targetPlatformCombId = $targetid; $poa->dMethodCombId = $dmethodid; $poa->insertedBy = $userid; $poa->save(); $poas = new Repository_Model_MetaPoaReleases(); $poas->filter->targetPlatformCombId->equals($target->id)->and($poas->filter->productReleaseId->equals($release->id)); if (count($poas->items) === 0) { $output = "Could not retrieve stored POA for release: " . $release->id . " and target: " . $target->id; return false; } else { $poa = $poas->items[0]; } } return $poa; }
public function save(Repository_Model_MetaPoaRelease $value) { global $application; $data = array(); if (!isnull($value->getId())) { $data['id'] = $value->getId(); } if (!isnull($value->getProductReleaseId())) { $data['productReleaseId'] = $value->getProductReleaseId(); } if (!isnull($value->getDisplayVersion())) { $data['displayVersion'] = $value->getDisplayVersion(); } if (!isnull($value->getReleaseNotes())) { $data['releaseNotes'] = $value->getReleaseNotes(); } if (!isnull($value->getChangeLog())) { $data['changeLog'] = $value->getChangeLog(); } if (!isnull($value->getRepositoryURL())) { $data['repositoryURL'] = $value->getRepositoryURL(); } if (!isnull($value->getTargetPlatformCombId())) { $data['targetPlatformCombId'] = $value->getTargetPlatformCombId(); } if (!isnull($value->getDMethodCombId())) { $data['dMethodCombId'] = $value->getDMethodCombId(); } if (!isnull($value->getQualityCriteriaVerificationReport())) { $data['qualityCriteriaVerificationReport'] = $value->getQualityCriteriaVerificationReport(); } if (!isnull($value->getStageRolloutReport())) { $data['stageRolloutReport'] = $value->getStageRolloutReport(); } if (!isnull($value->getAdditionalDetails())) { $data['additionalDetails'] = $value->getAdditionalDetails(); } if (!isnull($value->getDeleted())) { $data['deleted'] = $value->getDeleted(); } if (!isnull($value->getExtraFld1())) { $data['extraFld1'] = $value->getExtraFld1(); } if (!isnull($value->getExtraFld2())) { $data['extraFld2'] = $value->getExtraFld2(); } if (!isnull($value->getExtraFld3())) { $data['extraFld3'] = $value->getExtraFld3(); } if (!isnull($value->getExtraFld4())) { $data['extraFld4'] = $value->getExtraFld4(); } if (!isnull($value->getExtraFld5())) { $data['extraFld5'] = $value->getExtraFld5(); } if (!isnull($value->getTimestampInserted())) { $data['timestampInserted'] = $value->getTimestampInserted(); } if (!isnull($value->getTimestampLastUpdated())) { $data['timestampLastUpdated'] = $value->getTimestampLastUpdated(); } if (!isnull($value->getTimestampLastStateChange())) { $data['timestampLastStateChange'] = $value->getTimestampLastStateChange(); } $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); } }