Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/query/AlmanacServiceQuery.php
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | return $this->withNgramsConstraint( | ||||
$ngrams); | $ngrams); | ||||
} | } | ||||
public function needBindings($need_bindings) { | public function needBindings($need_bindings) { | ||||
$this->needBindings = $need_bindings; | $this->needBindings = $need_bindings; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function newResultObject() { | |||||
return new AlmanacService(); | |||||
} | |||||
protected function loadPage() { | protected function loadPage() { | ||||
return $this->loadStandardPage(new AlmanacService()); | return $this->loadStandardPage($this->newResultObject()); | ||||
} | } | ||||
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | ||||
$joins = parent::buildJoinClauseParts($conn); | $joins = parent::buildJoinClauseParts($conn); | ||||
if ($this->shouldJoinBindingTable()) { | if ($this->shouldJoinBindingTable()) { | ||||
$joins[] = qsprintf( | $joins[] = qsprintf( | ||||
$conn, | $conn, | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | final class AlmanacServiceQuery | ||||
} | } | ||||
protected function didFilterPage(array $services) { | protected function didFilterPage(array $services) { | ||||
if ($this->needBindings) { | if ($this->needBindings) { | ||||
$service_phids = mpull($services, 'getPHID'); | $service_phids = mpull($services, 'getPHID'); | ||||
$bindings = id(new AlmanacBindingQuery()) | $bindings = id(new AlmanacBindingQuery()) | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
->withServicePHIDs($service_phids) | ->withServicePHIDs($service_phids) | ||||
->needProperties($this->getNeedProperties()) | |||||
->execute(); | ->execute(); | ||||
$bindings = mgroup($bindings, 'getServicePHID'); | $bindings = mgroup($bindings, 'getServicePHID'); | ||||
foreach ($services as $service) { | foreach ($services as $service) { | ||||
$service_bindings = idx($bindings, $service->getPHID(), array()); | $service_bindings = idx($bindings, $service->getPHID(), array()); | ||||
$service->attachBindings($service_bindings); | $service->attachBindings($service_bindings); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |