Differential D9859 Diff 23678 src/applications/conpherence/query/ConpherenceParticipantCountQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/query/ConpherenceParticipantCountQuery.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Query class that answers the question: | * Query class that answers the question: | ||||
| * | * | ||||
| * - Q: How many unread conpherences am I participating in? | * - Q: How many unread conpherences am I participating in? | ||||
| * - A: | * - A: | ||||
| * id(new ConpherenceParticipantCountQuery()) | * id(new ConpherenceParticipantCountQuery()) | ||||
| * ->withParticipantPHIDs(array($my_phid)) | * ->withParticipantPHIDs(array($my_phid)) | ||||
| * ->withParticipationStatus(ConpherenceParticipationStatus::BEHIND) | * ->withParticipationStatus(ConpherenceParticipationStatus::BEHIND) | ||||
| * ->execute(); | * ->execute(); | ||||
| * | |||||
| * @group conpherence | |||||
| */ | */ | ||||
| final class ConpherenceParticipantCountQuery | final class ConpherenceParticipantCountQuery | ||||
| extends PhabricatorOffsetPagedQuery { | extends PhabricatorOffsetPagedQuery { | ||||
| private $participantPHIDs; | private $participantPHIDs; | ||||
| private $participationStatus; | private $participationStatus; | ||||
| public function withParticipantPHIDs(array $phids) { | public function withParticipantPHIDs(array $phids) { | ||||
| Show All 38 Lines | if ($this->participationStatus !== null) { | ||||
| 'participationStatus = %d', | 'participationStatus = %d', | ||||
| $this->participationStatus); | $this->participationStatus); | ||||
| } | } | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($where); | ||||
| } | } | ||||
| private function buildGroupByClause(AphrontDatabaseConnection $conn_r) { | private function buildGroupByClause(AphrontDatabaseConnection $conn_r) { | ||||
| $group_by = qsprintf( | $group_by = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'GROUP BY participantPHID'); | 'GROUP BY participantPHID'); | ||||
| return $group_by; | return $group_by; | ||||
| } | } | ||||
| } | } | ||||