Path: blob/master/src/applications/countdown/query/PhabricatorCountdownQuery.php
12256 views
<?php12final class PhabricatorCountdownQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $ids;6private $phids;7private $authorPHIDs;8private $upcoming;910public function withIDs(array $ids) {11$this->ids = $ids;12return $this;13}1415public function withPHIDs(array $phids) {16$this->phids = $phids;17return $this;18}1920public function withAuthorPHIDs(array $author_phids) {21$this->authorPHIDs = $author_phids;22return $this;23}2425public function withUpcoming() {26$this->upcoming = true;27return $this;28}2930public function newResultObject() {31return new PhabricatorCountdown();32}3334protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {35$where = parent::buildWhereClauseParts($conn);3637if ($this->ids !== null) {38$where[] = qsprintf(39$conn,40'id IN (%Ld)',41$this->ids);42}4344if ($this->phids !== null) {45$where[] = qsprintf(46$conn,47'phid IN (%Ls)',48$this->phids);49}5051if ($this->authorPHIDs !== null) {52$where[] = qsprintf(53$conn,54'authorPHID in (%Ls)',55$this->authorPHIDs);56}5758if ($this->upcoming !== null) {59$where[] = qsprintf(60$conn,61'epoch >= %d',62PhabricatorTime::getNow());63}6465return $where;66}6768public function getQueryApplicationClass() {69return 'PhabricatorCountdownApplication';70}7172public function getBuiltinOrders() {73return array(74'ending' => array(75'vector' => array('-epoch', '-id'),76'name' => pht('End Date (Past to Future)'),77),78'unending' => array(79'vector' => array('epoch', 'id'),80'name' => pht('End Date (Future to Past)'),81),82) + parent::getBuiltinOrders();83}8485public function getOrderableColumns() {86return array(87'epoch' => array(88'table' => $this->getPrimaryTableAlias(),89'column' => 'epoch',90'type' => 'int',91),92) + parent::getOrderableColumns();93}9495protected function newPagingMapFromPartialObject($object) {96return array(97'id' => (int)$object->getID(),98'epoch' => (int)$object->getEpoch(),99);100}101102}103104105