Have you looked at the SQL that Cake is producing? I have a feeling that this:

$this->Session->read('User')

is not returning what you expect.

And have a look at Mariano's Bindable behavior. It will save you lots
of grief. You can find it at the bakery.

On Fri, Jun 6, 2008 at 8:11 PM, Ken <[EMAIL PROTECTED]> wrote:
>
> 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 [email protected]
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