In my Jobs controller I have this statement under the index() function:
$this->Job->find('all', array('conditions' => array('Job.completed' => '0', 'Job.user_id' => $this->Auth->user('id'))));
$this->set('jobs', $this->paginate());
This should show all incomplete jobs for the currently logged in user under the $jobs variable (when accessed from a view). However, I’m getting all incomplete jobs for every user.
$this->Auth->user('id'); //returns correct user ID for logged in user
Have I missed something?
I’ve just revisited CakePHP after months of absence and I fear I may have to relearn some of the basics.
Thanks for your help!
🙂 welcome back to cake
$this->Job->find()will return an array.. it doesn’t modify the pagination. if you do :you will see that the conditions are correct..
to add conditions to the pagination you must change the pagination property, something like:
Hope this helps