Hi, this is my first week on CakePhP and I found it awesome.
I'm developing a web site for my fantasy football championship and I made a 
few model with the following associations:

*Team* has Many *Player*
*Player *belongTo *Team*
*Player *hasMany *Vote*
*Vote *belongTo *Player*
*
*
So relationships are Team --> Player --> Vote. Now I want to make a view 
that lists all the players for a specific team AND for each player I want 
to show statics about their votes. My Player mdoel is made like this:

class Player extends AppModel{
public $belongsTo = 'Team';
public $hasMany = array(
'Vote' => array(
'className' => 'Vote',
'fields' => array(
'AVG(Voto) as Media',
'SUM(Goal) as Goal',
'SUM(GoalSubito) as GoalSubito',
.... other fields with italian names btw
),
'group' => array('Giornata')
)
); 
}

when I wrote view for a specific player it works, but If I'm going to wrote 
the specific team view, data about single player votes does not appear from 
debug.

Array
(
    [Team] => Array
        (
            [ID] => 1
            [Nome] => Lokomotiv Wagon
            [Allenatore] => Luca "Ponch" Simonella
            [Budget] => 320
            [Stadio] => Julian Ross Stadium Memorial
            [Maglia] => 
            [Logo] => 
            [id] => 1
        )

    [Player] => Array
        (
            [0] => Array
                (
                    [ID] => 292
                    [Nome] => AMELIA
                    [Ruolo] => P
                    [Squadra] => MILAN
                    [Quota] => 1
                    [QuotaIniziale] => 2
                    [team_id] => 1
                )

            [1] => Array
                (
                    [ID] => 291
                    [Nome] => ABBIATI
                    [Ruolo] => P
                    [Squadra] => MILAN
                    [Quota] => 13
                    [QuotaIniziale] => 13
                    [team_id] => 1
                )

...

}


Have I to use recursive option? How can i go deeply on my association to 
retrieve data? I hope you could help.


Thank you


Luca

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to