mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
FIX BlogArchiveWidget for PostgreSQL compatibility
This commit is contained in:
parent
92f6192870
commit
8e684dea50
@ -92,15 +92,15 @@ class BlogArchiveWidget extends Widget
|
|||||||
$publishDate = DB::get_conn()->formattedDatetimeClause('"PublishDate"', $format);
|
$publishDate = DB::get_conn()->formattedDatetimeClause('"PublishDate"', $format);
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'PublishDate' => $publishDate,
|
'PublishDate' => $publishDate,
|
||||||
'Total' => "Count('PublishDate')"
|
'Total' => "COUNT('\"PublishDate\"')"
|
||||||
);
|
);
|
||||||
|
|
||||||
$stage = Versioned::current_stage();
|
$stage = Versioned::current_stage();
|
||||||
$suffix = ($stage === 'Live') ? '_Live' : '';
|
$suffix = ($stage === 'Live') ? '_Live' : '';
|
||||||
$query = SQLSelect::create($fields, "BlogPost{$suffix}")
|
$query = SQLSelect::create($fields, '"BlogPost' . $suffix . '"')
|
||||||
->addGroupBy($publishDate)
|
->addGroupBy($publishDate)
|
||||||
->addOrderBy('PublishDate Desc')
|
->addOrderBy('"PublishDate" DESC')
|
||||||
->addWhere(array('PublishDate < ?' => SS_Datetime::now()->Format('Y-m-d')));
|
->addWhere(array('"PublishDate" < ?' => SS_Datetime::now()->Format('Y-m-d')));
|
||||||
|
|
||||||
$posts = $query->execute();
|
$posts = $query->execute();
|
||||||
$result = new ArrayList();
|
$result = new ArrayList();
|
||||||
|
Loading…
Reference in New Issue
Block a user