Problem with Paginator->Sort Links


I have this in my controller:

public $paginate = [
    // Other keys here.
    'maxLimit' => 12,
    'order' => ['obj_preis' => 'desc']

when I debug this in my search.ctp:


it will show me always sortDir = asc

And this results in the problem, that the
echo $this->Paginator->sort(
__(‘Preis sortieren’),
[‘escape’ => false]

Link will always (!) do the sort in “desc” direction.
I really need urgent help with that and also willing to pay for a solution/fix on this matter.


First check if $paginate is took in account. Does ‘maxLimit’ and other keys works? Also you can try add model name before obj_preis like so:

public $paginate = [
    // Other keys here.
    'maxLimit' => 12,
    'order' => ['YourModel.obj_preis' => 'desc']