mirror of
https://github.com/flarum/framework.git
synced 2025-02-02 13:35:00 +08:00
Fix error when there are no orders on the query
This commit is contained in:
parent
d5e9ad84b8
commit
194de6be37
|
@ -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']);
|
||||
|
|
Loading…
Reference in New Issue
Block a user