Path: blob/master/src/applications/dashboard/query/PhabricatorDashboardQuery.php
12242 views
<?php12final class PhabricatorDashboardQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $ids;6private $phids;7private $statuses;8private $authorPHIDs;9private $canEdit;1011public function withIDs(array $ids) {12$this->ids = $ids;13return $this;14}1516public function withPHIDs(array $phids) {17$this->phids = $phids;18return $this;19}2021public function withStatuses(array $statuses) {22$this->statuses = $statuses;23return $this;24}2526public function withAuthorPHIDs(array $authors) {27$this->authorPHIDs = $authors;28return $this;29}3031public function withCanEdit($can_edit) {32$this->canEdit = $can_edit;33return $this;34}3536public function newResultObject() {37return new PhabricatorDashboard();38}3940protected function didFilterPage(array $dashboards) {4142$phids = mpull($dashboards, 'getPHID');4344if ($this->canEdit) {45$dashboards = id(new PhabricatorPolicyFilter())46->setViewer($this->getViewer())47->requireCapabilities(array(48PhabricatorPolicyCapability::CAN_EDIT,49))50->apply($dashboards);51}5253return $dashboards;54}5556protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {57$where = parent::buildWhereClauseParts($conn);5859if ($this->ids !== null) {60$where[] = qsprintf(61$conn,62'dashboard.id IN (%Ld)',63$this->ids);64}6566if ($this->phids !== null) {67$where[] = qsprintf(68$conn,69'dashboard.phid IN (%Ls)',70$this->phids);71}7273if ($this->statuses !== null) {74$where[] = qsprintf(75$conn,76'dashboard.status IN (%Ls)',77$this->statuses);78}7980if ($this->authorPHIDs !== null) {81$where[] = qsprintf(82$conn,83'dashboard.authorPHID IN (%Ls)',84$this->authorPHIDs);85}8687return $where;88}8990public function getQueryApplicationClass() {91return 'PhabricatorDashboardApplication';92}9394protected function getPrimaryTableAlias() {95return 'dashboard';96}9798}99100101