@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3/**
4 * @extends PhabricatorPackagesQuery<PhabricatorPackagesPublisher>
5 */
6final class PhabricatorPackagesPublisherQuery
7 extends PhabricatorPackagesQuery {
8
9 private $ids;
10 private $phids;
11 private $publisherKeys;
12
13 public function withIDs(array $ids) {
14 $this->ids = $ids;
15 return $this;
16 }
17
18 public function withPHIDs(array $phids) {
19 $this->phids = $phids;
20 return $this;
21 }
22
23 public function withPublisherKeys(array $keys) {
24 $this->publisherKeys = $keys;
25 return $this;
26 }
27
28 public function withNameNgrams($ngrams) {
29 return $this->withNgramsConstraint(
30 new PhabricatorPackagesPublisherNameNgrams(),
31 $ngrams);
32 }
33
34 public function newResultObject() {
35 return new PhabricatorPackagesPublisher();
36 }
37
38 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
39 $where = parent::buildWhereClauseParts($conn);
40
41 if ($this->ids !== null) {
42 $where[] = qsprintf(
43 $conn,
44 'u.id IN (%Ld)',
45 $this->ids);
46 }
47
48 if ($this->phids !== null) {
49 $where[] = qsprintf(
50 $conn,
51 'u.phid IN (%Ls)',
52 $this->phids);
53 }
54
55 if ($this->publisherKeys !== null) {
56 $where[] = qsprintf(
57 $conn,
58 'u.publisherKey IN (%Ls)',
59 $this->publisherKeys);
60 }
61
62 return $where;
63 }
64
65 protected function getPrimaryTableAlias() {
66 return 'u';
67 }
68
69}