We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Access intermediate table data

Hi,

I just started a project using Phalcon (wich I've never used before). I have a many to many relationship in my datas like this :

User : id, name

Game : id, date, score1, score2

UsersGames : id, user_id, game_id, team

Everything works fine with my models, but I dont know how to access UserGame.team. How do I do that ?

Thanks.



33.8k
Accepted
answer
edited Nov '14

https://docs.phalcon.io/es/latest/reference/models.html#relationships-between-models


$user->usersGame->team
$game->usersGame->team;
$usersgame->team;
```.