Reputation: 8137
This seems like a thing that is probably super easy in CakePHP, but I cannot find a clear example.
I would think this works in my controller:
public function index()
{
$this->paginate = [
'where' => ['user_id' => $this->Auth->user('id')],
'contain' => ['Users']
];
$slates = $this->paginate($this->Slates);
$this->set(compact('slates'));
$this->set('_serialize', ['slates']);
}
But I always get the full collection back. I am most definitely logged in, I have two unique users, I have created records with each of them.
Upvotes: 0
Views: 58
Reputation: 5041
Change where to conditions. Couldnt find a reference in the docs.
$this->paginate = [
'conditions' => ['user_id' => $this->Auth->user('id')],
'contain' => ['Users']
];
Upvotes: 3