Good night,
I’m updating my code to version 5 but I’m having a problem with the pager working.
Until now, I was looking for an entity (Ex. Companies) with other related entities of type hasMany (Ex. Workers), then I arrived at the pager, and no problem.
Now I look for the entity in the following way:
$company = $this->Companies->get($id, contain: ['Workers']);
$this->set(compact('company'));
And it gives me the following error “You must set a pagination instance using setPaginated()
first”
I try to use the setPaginated method or with $this->paginate($company->workers);
and it gives me this other error. I’m stuck and I don’t know how to continue.
I wonder if with the new version it is not possible to paginate an array of entities or I am not doing it correctly
Some help?