Support limiting maniphest queries to specific ids
Summary: This limits a maniphest task query to only contain certain ids set by the tasks query parameter. Test Plan: none yet, i wrote this at a computer with no phabricator install while bored and eating dinner. Reviewers: skrul, epriestley Reviewed By: epriestley CC: aran, davidreuss, epriestley, skrul Differential Revision: 1137
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
final class ManiphestTaskQuery {
|
||||
|
||||
private $taskIDs = array();
|
||||
private $authorPHIDs = array();
|
||||
private $ownerPHIDs = array();
|
||||
private $includeUnowned = null;
|
||||
@@ -63,6 +64,11 @@ final class ManiphestTaskQuery {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withTaskIDs(array $ids) {
|
||||
$this->taskIDs = $ids;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withOwners(array $owners) {
|
||||
$this->includeUnowned = false;
|
||||
foreach ($owners as $k => $phid) {
|
||||
@@ -147,6 +153,7 @@ final class ManiphestTaskQuery {
|
||||
}
|
||||
|
||||
$where = array();
|
||||
$where[] = $this->buildTaskIDsWhereClause($conn);
|
||||
$where[] = $this->buildStatusWhereClause($conn);
|
||||
$where[] = $this->buildPriorityWhereClause($conn);
|
||||
$where[] = $this->buildAuthorWhereClause($conn);
|
||||
@@ -227,6 +234,17 @@ final class ManiphestTaskQuery {
|
||||
return $task_dao->loadAllFromArray($data);
|
||||
}
|
||||
|
||||
private function buildTaskIDsWhereClause($conn) {
|
||||
if (!$this->taskIDs) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return qsprintf(
|
||||
$conn,
|
||||
'id in (%Ld)',
|
||||
$this->taskIDs);
|
||||
}
|
||||
|
||||
private function buildStatusWhereClause($conn) {
|
||||
switch ($this->status) {
|
||||
case self::STATUS_ANY:
|
||||
|
||||
Reference in New Issue
Block a user