Thanks again for your help, I went through the blog tutorial and
didn't see this, I'll re-read the manual for sure.
On Oct 17, 2:33 am, grigri <[EMAIL PROTECTED]> wrote:
> If you have Player belongsTo Team, and it's not an exclusive
> relationship (would make for quite a boring team) then Team hasMany
> Player.
> So declare that in your Team model:
>
> class Team extends AppModel {
> // ...
> var $hasMany = array('Player');
> // ...
>
> }
> >From there, whenever you do a find or findAll on Team with recursive
>
> set to 1 or more, you'll fetch the associated players:
>
> // somewhere deep inside teams_controller.php...
> $this->Team->recursive = 1;
> $team = $this->Team->findByName("Oakland Raiders");
> // $team['Player'] is an array of the players of the team
>
> This is all explained very well in the manual. I strongly suggest you
> give it (another?) read - especially the blog tutorial. And the
> associations chapter, of course.
>
> On Oct 17, 9:13 am, afx <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm extremely new to the world of PHP and cake. So far I've been able
> > to create a custom app with players and teams (players belong to
> > teams). The only problem is I can't for the life of me figure out how
> > to display all the players under one team!
>
> > For example how do I display every player under the Oakland Raider
> > table? In the player table I have a team_id that's associated with
> > the id from the teams table.
>
> > I think I use findall but I'm not sure exactly what to put in. Any
> > help would be awesome!!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---