Welcome Guest, Not a member yet? Register   Sign In
Model questions
#2

[eluser]Colin Williams[/eluser]
Quote:Also I have noticed that most example models return the SQL result set, doesn’t it make more sense to return an instance(s) of the model(s) its self, that is built from the query results?

Your model should typically return objects (or arrays of objects) that represent data that the application needs. Sometimes a query result is enough to represent the object, sometimes it is not (like when relations are involved.) Before you even write your application, it's a good idea to prototype the objects you plan to control in your app. Then you can write your app (models especially) around this prototype. And model != SQL query monkey. Sometimes models will query and parse files or directories, or call external services and APIs.


Messages In This Thread
Model questions - by El Forum - 10-14-2008, 02:45 PM
Model questions - by El Forum - 10-14-2008, 03:26 PM
Model questions - by El Forum - 10-14-2008, 04:13 PM
Model questions - by El Forum - 10-14-2008, 06:25 PM
Model questions - by El Forum - 10-15-2008, 01:01 AM
Model questions - by El Forum - 10-15-2008, 01:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB