Okay, thanks Grant. On Sep 4, 10:36 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > You want Post belongsTo User, User hasMany Post. > > On Sep 5, 3:25 pm, beetlecube <[EMAIL PROTECTED]> wrote: > > > Hi, hope someone can clear this simple thing up. > > > I have a Post model (posts table) > > ------------------------- > > Pri Key: int ID > > varchar[100] comment > > int User_id ( the user who posted it of course ) > > > and a User model (users table) > > --------------------------------- > > Pri Key int ID > > > varchar username .. other fields, too... > > > On my Posts view thtml page, I need for my findAll (run from posts > > controller of course) to get all of my Posts plus the User table > > record that belongs to that post. > > > But if I have a $hasOne in the Post model, the query attempts to join > > the Post.ID field with User.user_id which doesn't work of course. > > > But User table doesn't have any fields relating to posts at all. I > > simply have a user_id in the posts table so that I know who posted > > what. > > > Do I need to just use the Execute api call from the Model class to > > manually run this query? > > > It looks like cakePHP is needing for the Post.ID field specifically to > > link up to a foreign id in User. > > > Steve
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
