Returning standard objects with different queries |
[eluser]bapobap[/eluser]
Hi there, So I have my models returning nice objects formatted in a particular way. Each MySQL query does not directly map to an object, so I basically get the query result, build the object and then return it. This works great for something like: Code: $this->User_model->user(123456) which would return: Code: stdClass Object It doesn't work well for other uses. Say I'm getting a list of users who have uploaded an image. I get a result from the image table in MySQL. It has a user_id column for me to JOIN and get the user record. If I were to use Code: $this->User_model->user($image->user_id) Code: stdClass Object The fact I'm copying and pasting this for every sort of query I do that involves a user is a red flag. I know this isn't what I should be doing but I'm not sure what the solution is? |
Messages In This Thread |
Returning standard objects with different queries - by El Forum - 10-31-2009, 06:18 AM
Returning standard objects with different queries - by El Forum - 10-31-2009, 08:30 AM
Returning standard objects with different queries - by El Forum - 10-31-2009, 09:05 AM
Returning standard objects with different queries - by El Forum - 10-31-2009, 09:31 AM
|