Path: blob/master/src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php
12242 views
<?php12final class PhabricatorDashboardPanelQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $ids;6private $phids;7private $archived;8private $panelTypes;9private $authorPHIDs;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 withArchived($archived) {22$this->archived = $archived;23return $this;24}2526public function withPanelTypes(array $types) {27$this->panelTypes = $types;28return $this;29}3031public function withAuthorPHIDs(array $authors) {32$this->authorPHIDs = $authors;33return $this;34}3536public function newResultObject() {37// TODO: If we don't do this, SearchEngine explodes when trying to38// enumerate custom fields. For now, just give the panel a default panel39// type so custom fields work. In the long run, we may want to find a40// cleaner or more general approach for this.41$text_type = id(new PhabricatorDashboardTextPanelType())42->getPanelTypeKey();4344return id(new PhabricatorDashboardPanel())45->setPanelType($text_type);46}4748protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {49$where = parent::buildWhereClauseParts($conn);5051if ($this->ids !== null) {52$where[] = qsprintf(53$conn,54'panel.id IN (%Ld)',55$this->ids);56}5758if ($this->phids !== null) {59$where[] = qsprintf(60$conn,61'panel.phid IN (%Ls)',62$this->phids);63}6465if ($this->archived !== null) {66$where[] = qsprintf(67$conn,68'panel.isArchived = %d',69(int)$this->archived);70}7172if ($this->panelTypes !== null) {73$where[] = qsprintf(74$conn,75'panel.panelType IN (%Ls)',76$this->panelTypes);77}7879if ($this->authorPHIDs !== null) {80$where[] = qsprintf(81$conn,82'panel.authorPHID IN (%Ls)',83$this->authorPHIDs);84}8586return $where;87}8889public function getQueryApplicationClass() {90return 'PhabricatorDashboardApplication';91}9293protected function getPrimaryTableAlias() {94return 'panel';95}9697}9899100