@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
3final class ConpherenceParticipantQuery extends PhabricatorOffsetPagedQuery {
4
5 private $participantPHIDs;
6
7 public function withParticipantPHIDs(array $phids) {
8 $this->participantPHIDs = $phids;
9 return $this;
10 }
11
12 public function execute() {
13 $table = new ConpherenceParticipant();
14 $thread = new ConpherenceThread();
15
16 $conn = $table->establishConnection('r');
17
18 $data = queryfx_all(
19 $conn,
20 'SELECT * FROM %T participant JOIN %T thread
21 ON participant.conpherencePHID = thread.phid %Q %Q %Q',
22 $table->getTableName(),
23 $thread->getTableName(),
24 $this->buildWhereClause($conn),
25 $this->buildOrderClause($conn),
26 $this->buildLimitClause($conn));
27
28 return $table->loadAllFromArray($data);
29 }
30
31 protected function buildWhereClause(AphrontDatabaseConnection $conn) {
32 $where = array();
33
34 if ($this->participantPHIDs !== null) {
35 $where[] = qsprintf(
36 $conn,
37 'participantPHID IN (%Ls)',
38 $this->participantPHIDs);
39 }
40
41 return $this->formatWhereClause($conn, $where);
42 }
43
44 private function buildOrderClause(AphrontDatabaseConnection $conn) {
45 return qsprintf(
46 $conn,
47 'ORDER BY thread.dateModified DESC, thread.id DESC, participant.id DESC');
48 }
49
50}