Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/query/PhabricatorPeopleQuery.php
Show All 11 Lines | final class PhabricatorPeopleQuery | ||||
private $dateCreatedBefore; | private $dateCreatedBefore; | ||||
private $isAdmin; | private $isAdmin; | ||||
private $isSystemAgent; | private $isSystemAgent; | ||||
private $isMailingList; | private $isMailingList; | ||||
private $isDisabled; | private $isDisabled; | ||||
private $isApproved; | private $isApproved; | ||||
private $nameLike; | private $nameLike; | ||||
private $nameTokens; | private $nameTokens; | ||||
private $namePrefixes; | |||||
private $needPrimaryEmail; | private $needPrimaryEmail; | ||||
private $needProfile; | private $needProfile; | ||||
private $needProfileImage; | private $needProfileImage; | ||||
private $needAvailability; | private $needAvailability; | ||||
private $needBadges; | private $needBadges; | ||||
private $cacheKeys = array(); | private $cacheKeys = array(); | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | public function withNameLike($like) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withNameTokens(array $tokens) { | public function withNameTokens(array $tokens) { | ||||
$this->nameTokens = array_values($tokens); | $this->nameTokens = array_values($tokens); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withNamePrefixes(array $prefixes) { | |||||
$this->namePrefixes = $prefixes; | |||||
return $this; | |||||
} | |||||
public function needPrimaryEmail($need) { | public function needPrimaryEmail($need) { | ||||
$this->needPrimaryEmail = $need; | $this->needPrimaryEmail = $need; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function needProfile($need) { | public function needProfile($need) { | ||||
$this->needProfile = $need; | $this->needProfile = $need; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
if ($this->usernames !== null) { | if ($this->usernames !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'user.userName IN (%Ls)', | 'user.userName IN (%Ls)', | ||||
$this->usernames); | $this->usernames); | ||||
} | } | ||||
if ($this->namePrefixes) { | |||||
$parts = array(); | |||||
foreach ($this->namePrefixes as $name_prefix) { | |||||
$parts[] = qsprintf( | |||||
$conn, | |||||
'user.username LIKE %>', | |||||
$name_prefix); | |||||
} | |||||
$where[] = '('.implode(' OR ', $parts).')'; | |||||
} | |||||
if ($this->emails !== null) { | if ($this->emails !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'email.address IN (%Ls)', | 'email.address IN (%Ls)', | ||||
$this->emails); | $this->emails); | ||||
} | } | ||||
if ($this->realnames !== null) { | if ($this->realnames !== null) { | ||||
▲ Show 20 Lines • Show All 345 Lines • Show Last 20 Lines |