mirror of
https://github.com/flarum/framework.git
synced 2025-04-26 22:54:03 +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) {
|
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']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user