I'm in the process of creating my first web application with CakePHP, however I've run into some problems. I'll just start with the code:
class User extends AppModel { public $name = 'User'; public $belongsTo = 'Group'; public $hasMany = array( 'Tracker' => array( 'className' => 'Tracker', 'foreignKey' => 'user_id', 'dependent' => true, 'order' => 'Tracker.created DESC')); public $validate = array( 'username' => 'alphaNumeric', 'password' => 'notEmpty' ); } class Tracker extends AppModel { public $name = 'Tracker'; public $belongsTo = 'User'; public $hasMany = array( 'Log' => array( 'className' => 'Log', 'foreignKey' => 'tracker_id', 'dependent' => true, 'order' => 'Log.created DESC')); public $validate = array( 'name' => 'alphaNumeric', ); } class Log extends AppModel { public $name = 'Log'; public $belongsTo = 'Tracker'; public $validate = array(); } Basically you can see that each user has a tracker, and each tracker has a log. The problem is that when I'm displaying trackers, I want to display for each user ONLY the trackers that he or she owns. But instead of doing that, it returns back all the trackers, including ones that the user doesn't own. This is the code that I'm using: // inside of app/controllers/user_controller.php $this->set('trackers', $this->User->Tracker->find('all')); $this->set('totalTrackers', $this->User->Tracker->find('count')); Can someone help me solve the problem? Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en