I have two tables (item and category, I think they speak for themselves) and two associated model objects. I'm facing a design decisions in the function that fetches 1 item from the database. I need this method to also return the category (name, not just id) of the item.
I have two options:
- In the item model, use an SQL join to get the data faster.
- In the item model, call the category model to get the data, for better code.
Which should I do? I need a category model in any case, because I'll also be showing a list of categories, etc.