Welcome Guest, Not a member yet? Register   Sign In
Fetching all rows in database table - the OOP way?
#1

[eluser]medvind[/eluser]
I am quite new to OOP and to the MVC way of thinking and I'm curious about one thing.

I have a model for each database table. There are cross-references in the tables, so that for instance order.customer_id points to customer.id.

When fetching all rows in a database table, for instance, 'order', and to fetch the associated information like the customer's name and address, it seems most efficient to do a detailed, joined database query to fetch all fields at once. However, I've gotten the impression that I should do everything with objects for it to be "real" OOP. So then I would have to make an array of order objects which in turn would create a customer object each to fetch all data. This seems to me like a huge waste of resources, but maybe there is a point to it?

Maybe I've misunderstood what should and what should not be done with objects?


Messages In This Thread
Fetching all rows in database table - the OOP way? - by El Forum - 08-13-2009, 07:11 AM
Fetching all rows in database table - the OOP way? - by El Forum - 08-13-2009, 07:21 AM
Fetching all rows in database table - the OOP way? - by El Forum - 08-13-2009, 07:51 AM
Fetching all rows in database table - the OOP way? - by El Forum - 08-13-2009, 09:03 AM
Fetching all rows in database table - the OOP way? - by El Forum - 08-13-2009, 09:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB