diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php index cb28027046..4a87a723ca 100644 --- a/src/applications/project/query/PhabricatorProjectQuery.php +++ b/src/applications/project/query/PhabricatorProjectQuery.php @@ -16,7 +16,7 @@ * limitations under the License. */ -final class PhabricatorProjectQuery { +final class PhabricatorProjectQuery extends PhabricatorOffsetPagedQuery { private $ids; private $phids; @@ -29,9 +29,6 @@ final class PhabricatorProjectQuery { const STATUS_ACTIVE = 'status-active'; const STATUS_ARCHIVED = 'status-archived'; - private $limit; - private $offset; - private $needMembers; public function withIDs(array $ids) { @@ -49,16 +46,6 @@ final class PhabricatorProjectQuery { return $this; } - public function setLimit($limit) { - $this->limit = $limit; - return $this; - } - - public function setOffset($offset) { - $this->offset = $offset; - return $this; - } - public function withMemberPHIDs(array $member_phids) { $this->memberPHIDs = $member_phids; return $this; @@ -70,27 +57,11 @@ final class PhabricatorProjectQuery { } public function execute() { - $table = id(new PhabricatorProject()); + $table = new PhabricatorProject(); $conn_r = $table->establishConnection('r'); $where = $this->buildWhereClause($conn_r); $joins = $this->buildJoinsClause($conn_r); - - $limit = ''; - if ($this->limit) { - $limit = qsprintf( - $conn_r, - 'LIMIT %d, %d', - $this->offset, - $this->limit); - } else if ($this->offset) { - $limit = qsprintf( - $conn_r, - 'LIMIT %d, %d', - $this->offset, - PHP_INT_MAX); - } - $order = 'ORDER BY name'; $data = queryfx_all( @@ -100,7 +71,7 @@ final class PhabricatorProjectQuery { $joins, $where, $order, - $limit); + $this->buildLimitClause($conn_r)); $projects = $table->loadAllFromArray($data); @@ -169,13 +140,7 @@ final class PhabricatorProjectQuery { $this->phids); } - if ($where) { - $where = 'WHERE ('.implode(') AND (', $where).')'; - } else { - $where = ''; - } - - return $where; + return $this->formatWhereClause($where); } private function buildJoinsClause($conn_r) {