Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi all,

 

I used these forum long ago and I can no longer remember my login creds..... anyway this question isn't really about this book, but I felt it would go best in the "Quickpro" arena.

 

I'm wondering how you MVC users approach data handling. I'll create a simple scenario

 

- 3 Tables (a, b and c)

- Table a joins to table b which joins to table c

- I have a query which selects all "a" rows and how many "b" and "c" rows match each "a" row.

 

I steering clear of any ORM's for now and I'm using ->fetchObject in PDO mapping the data to the "a" model.

 

The Problem

 

The "a" model doesn't have an attribute for "total b rows" or "total c rows", is it ok by MVC law to store this data in the "a" object or should it be stored somewhere else, if so where?

 

Thanks for reading and hopefully replying

 

Simon

Link to comment
Share on other sites

Hey Simon,

 

Models don't have to map one-to-one to databases, especially when you're not using ORM. Your query is essentially creating a new data type and I would create a class that models it. That's my inclination given the information provided, at least.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...