troccoli / lva

This is a project to help the London Volleyball Association (LVA) Referee Administrators manage referees' appointments
MIT License
0 stars 0 forks source link

Refactor all models with method to get Ids on relations #128

Open troccoli opened 4 years ago

troccoli commented 4 years ago

If I have a competition and I want to get its season's id I need to do

$competition->getSeason()->getId();

But that queries the database to get the Season model, which is unnecessary, as the Competition model already has the season's id. I should be able to do

$competition->getSeasonId();

which under the hood returns $competition->season_id;