Doctrine 1.2 - Many-to-Many with extra fields

parovav

New Member
I have defined four MySQL tables:\[code\]accountsgamesgames_to_accountsstatus\[/code\]A typical many-to-many relationship involving accounts, games, and games_to_accounts is in place. However the games_to_accounts table has an extra field, status_id, which defineshow the associated account is treating the game (playing, for sale, etc).I can retrieve an account's games per usual just fine:\[code\]$account->Games\[/code\]In the GameAccount base model I've defined the hasOne relationship with the Status model like this:\[code\]$this->hasOne('Default_Model_Status as Status', array( 'local' => 'status_id', 'foreign' => 'id'));\[/code\]However when iterating over these games why in the world can't Iretrieve the status? Example:\[code\]foreach ($account->Games as $game){echo $game->Status->name;}\[/code\]Surely Doctrine supports the ability to add extra fields to anassociation table? Any help much appreciated, as I've looked everywhere for an answer yet am turning up nothing on what strikes me as a commonplace issue.Jason
 
Back
Top