Path: blob/master/src/applications/almanac/query/AlmanacNamespaceQuery.php
12256 views
<?php12final class AlmanacNamespaceQuery3extends AlmanacQuery {45private $ids;6private $phids;7private $names;89public function withIDs(array $ids) {10$this->ids = $ids;11return $this;12}1314public function withPHIDs(array $phids) {15$this->phids = $phids;16return $this;17}1819public function withNames(array $names) {20$this->names = $names;21return $this;22}2324public function withNameNgrams($ngrams) {25return $this->withNgramsConstraint(26new AlmanacNamespaceNameNgrams(),27$ngrams);28}2930public function newResultObject() {31return new AlmanacNamespace();32}3334protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {35$where = parent::buildWhereClauseParts($conn);3637if ($this->ids !== null) {38$where[] = qsprintf(39$conn,40'namespace.id IN (%Ld)',41$this->ids);42}4344if ($this->phids !== null) {45$where[] = qsprintf(46$conn,47'namespace.phid IN (%Ls)',48$this->phids);49}5051if ($this->names !== null) {52$where[] = qsprintf(53$conn,54'namespace.name IN (%Ls)',55$this->names);56}5758return $where;59}6061protected function getPrimaryTableAlias() {62return 'namespace';63}6465public function getOrderableColumns() {66return parent::getOrderableColumns() + array(67'name' => array(68'table' => $this->getPrimaryTableAlias(),69'column' => 'name',70'type' => 'string',71'unique' => true,72'reverse' => true,73),74);75}7677protected function newPagingMapFromPartialObject($object) {78return array(79'id' => (int)$object->getID(),80'name' => $object->getName(),81);82}8384public function getBuiltinOrders() {85return array(86'name' => array(87'vector' => array('name'),88'name' => pht('Namespace Name'),89),90) + parent::getBuiltinOrders();91}9293public function getQueryApplicationClass() {94return 'PhabricatorAlmanacApplication';95}9697}9899100