This is a follow-up to my previous question: Should dependent rows be fetched in the Model or the Controller?.
Let's say that a Patron can check out Books. If, given a Patron object, where and how should the Books they have checked out be fetched?
Here are some possibilities I've considered:
- In the Patron Model, add a
getBooks
method - When a Patron is instantiated, automatically get its books and store it as the
books
property - Create a method in the PatronMapper called
getBooks
that takes a Patron ID
What would you recommend? Thank you,
I suggest you to go with:
This way you don't have to manually worry about it