Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/storage/build/HarbormasterBuild.php
| <?php | <?php | ||||
| final class HarbormasterBuild extends HarbormasterDAO | final class HarbormasterBuild extends HarbormasterDAO | ||||
| implements | implements | ||||
| PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
| PhabricatorPolicyInterface { | PhabricatorPolicyInterface, | ||||
| PhabricatorConduitResultInterface { | |||||
| protected $buildablePHID; | protected $buildablePHID; | ||||
| protected $buildPlanPHID; | protected $buildPlanPHID; | ||||
| protected $buildStatus; | protected $buildStatus; | ||||
| protected $buildGeneration; | protected $buildGeneration; | ||||
| protected $buildParameters = array(); | protected $buildParameters = array(); | ||||
| protected $initiatorPHID; | protected $initiatorPHID; | ||||
| protected $planAutoKey; | protected $planAutoKey; | ||||
| ▲ Show 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | return $this->getBuildable()->hasAutomaticCapability( | ||||
| $capability, | $capability, | ||||
| $viewer); | $viewer); | ||||
| } | } | ||||
| public function describeAutomaticCapability($capability) { | public function describeAutomaticCapability($capability) { | ||||
| return pht('A build inherits policies from its buildable.'); | return pht('A build inherits policies from its buildable.'); | ||||
| } | } | ||||
| /* -( PhabricatorConduitResultInterface )---------------------------------- */ | |||||
| public function getFieldSpecificationsForConduit() { | |||||
| return array( | |||||
| id(new PhabricatorConduitSearchFieldSpecification()) | |||||
| ->setKey('buildablePHID') | |||||
| ->setType('phid') | |||||
| ->setDescription(pht('PHID of the object this build is building.')), | |||||
| id(new PhabricatorConduitSearchFieldSpecification()) | |||||
| ->setKey('buildPlanPHID') | |||||
| ->setType('phid') | |||||
| ->setDescription(pht('PHID of the build plan being run.')), | |||||
| id(new PhabricatorConduitSearchFieldSpecification()) | |||||
| ->setKey('buildStatus') | |||||
| ->setType('map<string, wild>') | |||||
| ->setDescription(pht('The current status of this build.')), | |||||
| id(new PhabricatorConduitSearchFieldSpecification()) | |||||
| ->setKey('initiatorPHID') | |||||
| ->setType('phid') | |||||
epriestley: Maybe `'phid'`. | |||||
| ->setDescription(pht('The person (or thing) that started this build.')), | |||||
| ); | |||||
| } | |||||
| public function getFieldValuesForConduit() { | |||||
| $status = $this->getBuildStatus(); | |||||
| return array( | |||||
| 'buildablePHID' => $this->getBuildablePHID(), | |||||
| 'buildPlanPHID' => $this->getBuildPlanPHID(), | |||||
Done Inline ActionsMaybe model this on ManiphestTask, e.g.: 'status' => array( 'value' => 'passed', 'name' => "Passed", ) Then we can add more stuff later with a minimal compatibility break. epriestley: Maybe model this on `ManiphestTask`, e.g.:
```
'status' => array(
'value' => 'passed'… | |||||
Not Done Inline ActionsI always like to keep API responses "normalized" and stray away from unstructured (eg, a name or a url) data as much as possible. Unless, of course, there is an underlying use case :) yelirekim: I always like to keep API responses "normalized" and stray away from unstructured (eg, a name… | |||||
| 'buildStatus' => array( | |||||
| 'value' => $status, | |||||
| 'name' => HarbormasterBuildStatus::getBuildStatusName($status), | |||||
| ), | |||||
| 'initiatorPHID' => nonempty($this->getInitiatorPHID(), null), | |||||
| ); | |||||
| } | |||||
Not Done Inline ActionsThis needs to be id(new ...), not just (new ...), to compile/run on older PHP. epriestley: This needs to be `id(new ...)`, not just `(new ...)`, to compile/run on older PHP. | |||||
| public function getConduitSearchAttachments() { | |||||
| return array( | |||||
| id(new HarbormasterQueryBuildsSearchEngineAttachment()) | |||||
| ->setAttachmentKey('querybuilds'), | |||||
| ); | |||||
| } | |||||
| } | } | ||||
Maybe 'phid'.