mirror of
https://github.com/flarum/core.git
synced 2025-08-03 15:07:53 +02:00
Fix error when there are no orders on the query
This commit is contained in:
@@ -15,6 +15,10 @@ class StickySearchModifier
|
|||||||
if ($event->criteria->sort === null) {
|
if ($event->criteria->sort === null) {
|
||||||
$query = $event->searcher->query();
|
$query = $event->searcher->query();
|
||||||
|
|
||||||
|
if (!is_array($query->orders)) {
|
||||||
|
$query->orders = [];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($event->searcher->getActiveGambits() as $gambit) {
|
foreach ($event->searcher->getActiveGambits() as $gambit) {
|
||||||
if ($gambit instanceof CategoryGambit) {
|
if ($gambit instanceof CategoryGambit) {
|
||||||
array_unshift($query->orders, ['column' => 'is_sticky', 'direction' => 'desc']);
|
array_unshift($query->orders, ['column' => 'is_sticky', 'direction' => 'desc']);
|
||||||
|
Reference in New Issue
Block a user