Cake 4.x Error Paginator::extractData() on pagination

Hi, In my controller, every controller, when I try to set the pagination on the query always fails whit this error:
**# Argument 1 passed to Cake\Datasource\Paginator::extractData() must implement interface Cake\Datasource\RepositoryInterface, instance of Cake\ORM\ResultSet given, called in /share/CACHEDEV1_DATA/htdocs/alterecoGEST/vendor/cakephp/cakephp/src/Datasource/Paginator.php on line 176

my controller

src/Controller/AnagclientiController.php
             public function index()
            {       
                $this->loadComponent('Paginator');
                $clienti=$this->Paginator->paginate($this->Anagclienti->find('all',['order'=>'Anagclienti.ragione_sociale'])->all());
    $this->set('clienti',$clienti);
        }

Can someone help me?

Please try to you change your Query from:

$clienti=$this->Paginator->paginate($this->Anagclienti->find(‘all’, [‘order’=>‘Anagclienti.ragione_sociale’])
->all());

to

$clienti=$this->Paginator->paginate($this->Anagclienti->find(‘all’,[‘order’=>[‘Anagclienti.ragione_sociale’=>'ASC])
);

1 Like

Same error.
Without $this->Paginator->paginate the query work

sorry, you are right
work it
I had not taken off ->all()