Differential D20955 Diff 49930 src/applications/diffusion/herald/DiffusionCommitAuthorProjectsHeraldField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/herald/DiffusionCommitAuthorProjectsHeraldField.php
| <?php | <?php | ||||
| final class DiffusionCommitAuthorProjectsHeraldField | final class DiffusionCommitAuthorProjectsHeraldField | ||||
| extends DiffusionCommitHeraldField { | extends DiffusionCommitHeraldField { | ||||
| const FIELDCONST = 'diffusion.commit.author.projects'; | const FIELDCONST = 'diffusion.commit.author.projects'; | ||||
| public function getHeraldFieldName() { | public function getHeraldFieldName() { | ||||
| return pht("Author's projects"); | return pht("Author's projects"); | ||||
| } | } | ||||
| public function getHeraldFieldValue($object) { | public function getHeraldFieldValue($object) { | ||||
| $adapter = $this->getAdapter(); | $adapter = $this->getAdapter(); | ||||
| $viewer = $adapter->getViewer(); | |||||
| $phid = $object->getCommitData()->getCommitDetail('authorPHID'); | $phid = $adapter->getAuthorPHID(); | ||||
| if (!$phid) { | if (!$phid) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| $viewer = $adapter->getViewer(); | |||||
| $projects = id(new PhabricatorProjectQuery()) | $projects = id(new PhabricatorProjectQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withMemberPHIDs(array($phid)) | ->withMemberPHIDs(array($phid)) | ||||
| ->execute(); | ->execute(); | ||||
| return mpull($projects, 'getPHID'); | return mpull($projects, 'getPHID'); | ||||
| } | } | ||||
| Show All 9 Lines | |||||