3 final class PhabricatorRepositoryIdentityQuery
4 extends PhabricatorCursorPagedPolicyAwareQuery
{
8 private $identityNames;
9 private $emailAddresses;
10 private $assignedPHIDs;
11 private $effectivePHIDs;
12 private $identityNameLike;
13 private $hasEffectivePHID;
14 private $relatedPHIDs;
16 public function withIDs(array $ids) {
21 public function withPHIDs(array $phids) {
22 $this->phids
= $phids;
26 public function withIdentityNames(array $names) {
27 $this->identityNames
= $names;
31 public function withIdentityNameLike($name_like) {
32 $this->identityNameLike
= $name_like;
36 public function withEmailAddresses(array $addresses) {
37 $this->emailAddresses
= $addresses;
41 public function withAssignedPHIDs(array $assigned) {
42 $this->assignedPHIDs
= $assigned;
46 public function withEffectivePHIDs(array $effective) {
47 $this->effectivePHIDs
= $effective;
51 public function withRelatedPHIDs(array $related) {
52 $this->relatedPHIDs
= $related;
56 public function withHasEffectivePHID($has_effective_phid) {
57 $this->hasEffectivePHID
= $has_effective_phid;
61 public function newResultObject() {
62 return new PhabricatorRepositoryIdentity();
65 protected function getPrimaryTableAlias() {
69 protected function buildWhereClauseParts(AphrontDatabaseConnection
$conn) {
70 $where = parent
::buildWhereClauseParts($conn);
72 if ($this->ids
!== null) {
75 'identity.id IN (%Ld)',
79 if ($this->phids
!== null) {
82 'identity.phid IN (%Ls)',
86 if ($this->assignedPHIDs
!== null) {
89 'identity.manuallySetUserPHID IN (%Ls)',
90 $this->assignedPHIDs
);
93 if ($this->effectivePHIDs
!== null) {
96 'identity.currentEffectiveUserPHID IN (%Ls)',
97 $this->effectivePHIDs
);
100 if ($this->hasEffectivePHID
!== null) {
101 if ($this->hasEffectivePHID
) {
104 'identity.currentEffectiveUserPHID IS NOT NULL');
108 'identity.currentEffectiveUserPHID IS NULL');
112 if ($this->identityNames
!== null) {
113 $name_hashes = array();
114 foreach ($this->identityNames
as $name) {
115 $name_hashes[] = PhabricatorHash
::digestForIndex($name);
120 'identity.identityNameHash IN (%Ls)',
124 if ($this->emailAddresses
!== null) {
127 'identity.emailAddress IN (%Ls)',
128 $this->emailAddresses
);
131 if ($this->identityNameLike
!= null) {
134 'identity.identityNameRaw LIKE %~',
135 $this->identityNameLike
);
138 if ($this->relatedPHIDs
!== null) {
141 '(identity.manuallySetUserPHID IN (%Ls) OR
142 identity.currentEffectiveUserPHID IN (%Ls) OR
143 identity.automaticGuessedUserPHID IN (%Ls))',
146 $this->relatedPHIDs
);
152 public function getQueryApplicationClass() {
153 return 'PhabricatorDiffusionApplication';