Path: blob/master/src/applications/harbormaster/query/HarbormasterBuildUnitMessageQuery.php
12256 views
<?php12final class HarbormasterBuildUnitMessageQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $ids;6private $phids;7private $targetPHIDs;89public function withIDs(array $ids) {10$this->ids = $ids;11return $this;12}1314public function withPHIDs(array $phids) {15$this->phids = $phids;16return $this;17}1819public function withBuildTargetPHIDs(array $target_phids) {20$this->targetPHIDs = $target_phids;21return $this;22}2324public function newResultObject() {25return new HarbormasterBuildUnitMessage();26}2728protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {29$where = parent::buildWhereClauseParts($conn);3031if ($this->ids !== null) {32$where[] = qsprintf(33$conn,34'id IN (%Ld)',35$this->ids);36}3738if ($this->phids !== null) {39$where[] = qsprintf(40$conn,41'phid in (%Ls)',42$this->phids);43}4445if ($this->targetPHIDs !== null) {46$where[] = qsprintf(47$conn,48'buildTargetPHID in (%Ls)',49$this->targetPHIDs);50}5152return $where;53}5455protected function didFilterPage(array $messages) {56$indexes = array();57foreach ($messages as $message) {58$index = $message->getNameIndex();59if (strlen($index)) {60$indexes[$index] = $index;61}62}6364if ($indexes) {65$map = HarbormasterString::newIndexMap($indexes);6667foreach ($messages as $message) {68$index = $message->getNameIndex();6970if (!strlen($index)) {71continue;72}7374$name = idx($map, $index);75if ($name === null) {76$name = pht('Unknown Unit Message ("%s")', $index);77}7879$message->setName($name);80}81}8283return $messages;84}8586public function getQueryApplicationClass() {87return 'PhabricatorHarbormasterApplication';88}8990}919293