I have 2 entities, namely Match and Team. A Team can have one to many Matches. However, my Match entity consts of 2 fields which reference the same entity, Team. They are $homeT
After exploring Doctrine's official docs: you can't add multiple mappedBy
columns. Instead of this, you can choose between:
Match
and define method getAllMatchesForTeam($team)
$homeMatches
and $awayMatches
+ method getAllMatches()
on Team
and union results of $homeMatches
and $awayMatches
thereRead more here: