In my workers controller I added a function to List all workers.
$query = $this->Workers->find();
$query = $this->Authorization->applyScope($query);
$workers = $this->paginate($query);
and in WorkersTablePolicy
public function scopeListClients(IdentityInterface $user, $query): SelectQuery
{
return $query->where(['Workers.rolde_id' => 2]);
}
But when I call this method, I will get an error from Authorization.
App\Policy\WorkersTablePolicy::scopeListClients(): Return value must be of type Cake\ORM\SelectQuery, Cake\ORM\Query\SelectQuery returned
What is going wrong?