Fix error when there are no orders on the query

This commit is contained in:
Toby Zerner 2015-06-03 18:05:23 +09:30
parent d5e9ad84b8
commit 194de6be37

View File

@ -15,6 +15,10 @@ class StickySearchModifier
if ($event->criteria->sort === null) {
$query = $event->searcher->query();
if (!is_array($query->orders)) {
$query->orders = [];
}
foreach ($event->searcher->getActiveGambits() as $gambit) {
if ($gambit instanceof CategoryGambit) {
array_unshift($query->orders, ['column' => 'is_sticky', 'direction' => 'desc']);