I have an entity, such as Game, with some properties like time, and it has a load of Event entities underneath it. Some information about the game is implicitly stored in the entities, e.g. the number of deaths (given by the number of death events).
If I want to display the number of deaths in a template (which has access to the game object), where do I put the logic?
I can think of a few options, but I'm not sure which is the 'correct' thing to do.
- Put a getDeaths() function in a Repository
I get the impression that's where it's supposed to go, but I don't know how to access that properly from the template. - Put a getDeaths() function in the
Gameentity
The easiest thing to do, because it's easily accessed from a template. - Create a function in the Controller
It doesn't seem flexible to ask a controller for this information