Im on my Team model (teams table) trying to use the TeamsUser /
Players HABTM.

$this->Team->TeamsUser->function() AND $this->Team->Players->function
() did not work.

class Team extends AppModel {

        /**
         * Reduce usage
         */
        var $recursive = -1;

        /**
         * Teams belong to a country, state
         */
        var $belongsTo = array(
                'Country', 'State',
                'Creator' => array(
                        'className' => 'User',
                        'foreignKey' => 'creator_id',
                        'fields' => array('Creator.id', 'Creator.username',
'Creator.handle', 'Creator.avatar')
                )
        );

        /**
         * Team has many members and games
         */
        var $hasAndBelongsToMany = array(
                'Leader' => array(
                        'className'                             => 'User',
                        'fields'                                => 
array('Leader.id', 'Leader.username',
'Leader.handle', 'Leader.avatar'),
                        'conditions'                    => 
array('TeamsUser.role' => 'leader'),
                        'foreignKey'                    => 'team_id',
                        'associationForeignKey' => 'user_id',
                        'limit'                                 => 1
                ),
                'Players' => array(
                        'className'                             => 'User',
                        'fields'                                => 
array('Players.id', 'Players.username',
'Players.handle', 'Players.avatar'),
                        'conditions'                    => 
array('TeamsUser.role !=' => 'leader',
'TeamsUser.status' => 'approved'),
                        'foreignKey'                    => 'team_id',
                        'associationForeignKey' => 'user_id'
                ),
                'Games' => array(
                        'className'                     => 'GamesSystem',
                        'joinTable'                             => 
'teams_games',
                        'foreignKey'                    => 'team_id',
                        'associationForeignKey' => 'games_system_id'
                )
        );
}
--~--~---------~--~----~------------~-------~--~----~
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