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);
|
||||
$fields = array(
|
||||
'PublishDate' => $publishDate,
|
||||
'Total' => "Count('PublishDate')"
|
||||
'Total' => "COUNT('\"PublishDate\"')"
|
||||
);
|
||||
|
||||
$stage = Versioned::current_stage();
|
||||
$suffix = ($stage === 'Live') ? '_Live' : '';
|
||||
$query = SQLSelect::create($fields, "BlogPost{$suffix}")
|
||||
$query = SQLSelect::create($fields, '"BlogPost' . $suffix . '"')
|
||||
->addGroupBy($publishDate)
|
||||
->addOrderBy('PublishDate Desc')
|
||||
->addWhere(array('PublishDate < ?' => SS_Datetime::now()->Format('Y-m-d')));
|
||||
->addOrderBy('"PublishDate" DESC')
|
||||
->addWhere(array('"PublishDate" < ?' => SS_Datetime::now()->Format('Y-m-d')));
|
||||
|
||||
$posts = $query->execute();
|
||||
$result = new ArrayList();
|
||||
|
Loading…
Reference in New Issue
Block a user