distortionzzz Posted October 30, 2012 Share Posted October 30, 2012 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 More sharing options...
Larry Posted October 30, 2012 Share Posted October 30, 2012 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. 1 Link to comment Share on other sites More sharing options...
distortionzzz Posted October 31, 2012 Author Share Posted October 31, 2012 Hi, Hmm, do you mean as in a class that will store the object and the misc data around it? That could be the correct approach, I hate how sometimes programming strictly can make a task so long winded and convoluted. Thanks for you views. Simon Link to comment Share on other sites More sharing options...
Larry Posted October 31, 2012 Share Posted October 31, 2012 I'm not sure what you mean about a class storing an object. Link to comment Share on other sites More sharing options...
Recommended Posts