Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/query/PhamePostQuery.php
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | protected function willFilterPage(array $posts) { | ||||
} | } | ||||
return $posts; | return $posts; | ||||
} | } | ||||
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
$where = parent::buildWhereClauseParts($conn); | $where = parent::buildWhereClauseParts($conn); | ||||
if ($this->ids) { | if ($this->ids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'id IN (%Ld)', | 'p.id IN (%Ld)', | ||||
$this->ids); | $this->ids); | ||||
} | } | ||||
if ($this->phids) { | if ($this->phids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'phid IN (%Ls)', | 'p.phid IN (%Ls)', | ||||
$this->phids); | $this->phids); | ||||
} | } | ||||
if ($this->bloggerPHIDs) { | if ($this->bloggerPHIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'bloggerPHID IN (%Ls)', | 'p.bloggerPHID IN (%Ls)', | ||||
$this->bloggerPHIDs); | $this->bloggerPHIDs); | ||||
} | } | ||||
if ($this->visibility) { | if ($this->visibility !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'visibility IN (%Ld)', | 'p.visibility IN (%Ld)', | ||||
$this->visibility); | $this->visibility); | ||||
} | } | ||||
if ($this->publishedAfter !== null) { | if ($this->publishedAfter !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'datePublished > %d', | 'p.datePublished > %d', | ||||
$this->publishedAfter); | $this->publishedAfter); | ||||
} | } | ||||
if ($this->blogPHIDs !== null) { | if ($this->blogPHIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'blogPHID in (%Ls)', | 'p.blogPHID in (%Ls)', | ||||
$this->blogPHIDs); | $this->blogPHIDs); | ||||
} | } | ||||
return $where; | return $where; | ||||
} | } | ||||
public function getBuiltinOrders() { | public function getBuiltinOrders() { | ||||
return array( | return array( | ||||
'datePublished' => array( | 'datePublished' => array( | ||||
'vector' => array('datePublished', 'id'), | 'vector' => array('datePublished', 'id'), | ||||
'name' => pht('Publish Date'), | 'name' => pht('Publish Date'), | ||||
), | ), | ||||
) + parent::getBuiltinOrders(); | ) + parent::getBuiltinOrders(); | ||||
} | } | ||||
public function getOrderableColumns() { | public function getOrderableColumns() { | ||||
return parent::getOrderableColumns() + array( | return parent::getOrderableColumns() + array( | ||||
'datePublished' => array( | 'datePublished' => array( | ||||
'table' => $this->getPrimaryTableAlias(), | |||||
'column' => 'datePublished', | 'column' => 'datePublished', | ||||
'type' => 'int', | 'type' => 'int', | ||||
'reverse' => false, | 'reverse' => false, | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
protected function getPagingValueMap($cursor, array $keys) { | protected function getPagingValueMap($cursor, array $keys) { | ||||
$post = $this->loadCursorObject($cursor); | $post = $this->loadCursorObject($cursor); | ||||
$map = array( | $map = array( | ||||
'datePublished' => $post->getDatePublished(), | 'datePublished' => $post->getDatePublished(), | ||||
'id' => $post->getID(), | 'id' => $post->getID(), | ||||
); | ); | ||||
return $map; | return $map; | ||||
} | } | ||||
public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
// TODO: Does setting this break public blogs? | // TODO: Does setting this break public blogs? | ||||
return null; | return null; | ||||
} | } | ||||
protected function getPrimaryTableAlias() { | |||||
return 'p'; | |||||
} | |||||
} | } |