Path: blob/master/src/applications/people/query/PhabricatorPeopleUserEmailQuery.php
12256 views
<?php12final class PhabricatorPeopleUserEmailQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $ids;6private $phids;78public function withIDs(array $ids) {9$this->ids = $ids;10return $this;11}1213public function withPHIDs(array $phids) {14$this->phids = $phids;15return $this;16}1718public function newResultObject() {19return new PhabricatorUserEmail();20}2122protected function getPrimaryTableAlias() {23return 'email';24}2526protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {27$where = parent::buildWhereClauseParts($conn);2829if ($this->ids !== null) {30$where[] = qsprintf(31$conn,32'email.id IN (%Ld)',33$this->ids);34}3536if ($this->phids !== null) {37$where[] = qsprintf(38$conn,39'email.phid IN (%Ls)',40$this->phids);41}4243return $where;44}4546protected function willLoadPage(array $page) {4748$user_phids = mpull($page, 'getUserPHID');4950$users = id(new PhabricatorPeopleQuery())51->setViewer($this->getViewer())52->setParentQuery($this)53->withPHIDs($user_phids)54->execute();55$users = mpull($users, null, 'getPHID');5657foreach ($page as $key => $address) {58$user = idx($users, $address->getUserPHID());5960if (!$user) {61unset($page[$key]);62$this->didRejectResult($address);63continue;64}6566$address->attachUser($user);67}6869return $page;70}7172public function getQueryApplicationClass() {73return 'PhabricatorPeopleApplication';74}7576}777879