Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / tokens / query / PhabricatorTokenCountQuery.php
blobc4694af607fdf2703e60296f9b7d5c62e5610565
1 <?php
3 final class PhabricatorTokenCountQuery
4 extends PhabricatorOffsetPagedQuery {
6 private $objectPHIDs;
8 public function withObjectPHIDs(array $object_phids) {
9 $this->objectPHIDs = $object_phids;
10 return $this;
13 public function execute() {
14 $table = new PhabricatorTokenCount();
15 $conn_r = $table->establishConnection('r');
17 $rows = queryfx_all(
18 $conn_r,
19 'SELECT objectPHID, tokenCount FROM %T %Q %Q',
20 $table->getTableName(),
21 $this->buildWhereClause($conn_r),
22 $this->buildLimitClause($conn_r));
24 return ipull($rows, 'tokenCount', 'objectPHID');
27 protected function buildWhereClause(AphrontDatabaseConnection $conn) {
28 $where = array();
30 if ($this->objectPHIDs) {
31 $where[] = qsprintf(
32 $conn,
33 'objectPHID IN (%Ls)',
34 $this->objectPHIDs);
37 return $this->formatWhereClause($conn, $where);