This worked. Thanks!

On Oct 16, 6:21 am, grigri <[EMAIL PROTECTED]> wrote:
> Try this:
>
>   function add() {
>     $this->set('teams',$this->Team->generateList(
>                    null, null, null, "{n}.Team.id", "{n}.Team.name")
>                    );
>     if (!empty($this->data['Player']))
>     {
>       if ($this->Player->save($this->data['Player']))
>       {
>         $this->flash('Player added','/players/');
>       }
>     }
>   }
>
> Model data is indexed by the singular (data['Player'] not
> data['Players']), and since in your controller you're using Team and
> Player there's no need to access team through player ($this->Team
> instead of $this->Player)
>
> On Oct 16, 7:45 am, afx <[EMAIL PROTECTED]> wrote:
>
> > I'm running into problems when i try to customize my fantasy football
> > app! I had it working perfectly where players belong to teams and you
> > could create new players and select a team from the drop down, won't
> > work now.
>
> > I can view everything fine, but when I save it doesn't store the
> > relationship between my teams and players!  I don't know what I'm
> > doing wrong and any help would be helpful. Thanks!
>
> > <?
> > class PlayersController extends AppController {
> >   var $name = 'Players
> >   var $uses = array('Team,'Player');
> >   var $scaffold;
>
> >   function index() {
> >     $this->set('players',$this->Player->findAll());
> >     $this->set('teams',$this->Team->findAll());
> >   }
>
> >   function add() {
> >     $this->set('teams',$this->Player->Team->generateList(
> >                    null, null, null, "{n}.Team.id", "{n}.Team.name")
> >                    );
> >     if (!empty($this->data['Players']))
> >     {
> >       if ($this->Player->save($this->data['Players']))
> >       {
> >         $this->flash('Player added','/players/');
> >       }
> >     }
> >   }}
>
> > ?>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to