Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / auth / query / PhabricatorAuthChallengeQuery.php
blob195abe0884e0347f562379f2190c77006f0bac44
1 <?php
3 final class PhabricatorAuthChallengeQuery
4 extends PhabricatorCursorPagedPolicyAwareQuery {
6 private $ids;
7 private $phids;
8 private $userPHIDs;
9 private $factorPHIDs;
10 private $challengeTTLMin;
11 private $challengeTTLMax;
13 public function withIDs(array $ids) {
14 $this->ids = $ids;
15 return $this;
18 public function withPHIDs(array $phids) {
19 $this->phids = $phids;
20 return $this;
23 public function withUserPHIDs(array $user_phids) {
24 $this->userPHIDs = $user_phids;
25 return $this;
28 public function withFactorPHIDs(array $factor_phids) {
29 $this->factorPHIDs = $factor_phids;
30 return $this;
33 public function withChallengeTTLBetween($challenge_min, $challenge_max) {
34 $this->challengeTTLMin = $challenge_min;
35 $this->challengeTTLMax = $challenge_max;
36 return $this;
39 public function newResultObject() {
40 return new PhabricatorAuthChallenge();
43 protected function loadPage() {
44 return $this->loadStandardPage($this->newResultObject());
47 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
48 $where = parent::buildWhereClauseParts($conn);
50 if ($this->ids !== null) {
51 $where[] = qsprintf(
52 $conn,
53 'id IN (%Ld)',
54 $this->ids);
57 if ($this->phids !== null) {
58 $where[] = qsprintf(
59 $conn,
60 'phid IN (%Ls)',
61 $this->phids);
64 if ($this->userPHIDs !== null) {
65 $where[] = qsprintf(
66 $conn,
67 'userPHID IN (%Ls)',
68 $this->userPHIDs);
71 if ($this->factorPHIDs !== null) {
72 $where[] = qsprintf(
73 $conn,
74 'factorPHID IN (%Ls)',
75 $this->factorPHIDs);
78 if ($this->challengeTTLMin !== null) {
79 $where[] = qsprintf(
80 $conn,
81 'challengeTTL >= %d',
82 $this->challengeTTLMin);
85 if ($this->challengeTTLMax !== null) {
86 $where[] = qsprintf(
87 $conn,
88 'challengeTTL <= %d',
89 $this->challengeTTLMax);
92 return $where;
95 public function getQueryApplicationClass() {
96 return 'PhabricatorAuthApplication';