Just started developing with CakePHP a few weeks ago. Loved it until I
ran into this seemingly simple problem that is proving difficult to
navigate. Using CakePHP 1.2 Nightly from 6 Jun 2008:

I have a standard HABTM relationship. In this case it is Courses and
Users. A course can have many users (students), and a user (student)
can have many courses. When the user logs in, I would like to restrict
the courses view to only courses associated with that particular user.
Seem like a simple question? I can't make it work.

Here is my best shot so far:

$conditions = array('User.username' => $this->Session->read('User'));
$courselist = $this->Course->find('all',array('conditions' =>
$conditions,
                                                  'recursive' => 5));

I kept playing with the recursive number, but based on the SQL I'm
seeing I simply can't get the course model to retrieve data from the
user model. I verified using scaffolding that the associations are
properly established.

Ken

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to