Problem with Paginator->Sort Links

Hi,

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:

debug($this->Paginator->sortKey());
debug($this->Paginator->sortDir());

it will show me always sortDir = asc

And this results in the problem, that the
echo $this->Paginator->sort(
‘obj_preis’,
__(‘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.

Thanks!

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']
];