cakephp-api icon indicating copy to clipboard operation
cakephp-api copied to clipboard

Unable to use Order like Paginate

Open jayevt opened this issue 10 months ago • 0 comments

I am using below query to set order direction.

$order[$sortField] = $sortDirection;

$query = $this->getTable()
    ->find('search', ['search' => $requestQuery])
    ->order($order);

I am using below event. It is setting pagination. $this->dispatchEvent('Action.Crud.afterFindEntities', compact('query', 'records'));

Is it possible to use order automatically instead of setting it manually like paginator.

Paginator Example:

  public $paginate = [
      'limit' => 25,
      'order' => [
          'Articles.title' => 'asc'
      ]
  ];

jayevt avatar Feb 27 '25 11:02 jayevt