Welcome Guest, Not a member yet? Register   Sign In
At what point do you seperate things into different models?
#9

We tend to think of models as an object, not necessarily a single table (although some are), more the actions that can be applied to an object. We have one "listing" model that pulls static lists for everything in our app and a model for each object.

Ex:

- a model named "role" that has insert, update, delete, get methods
- a model named "user" that has the same methods, as well as a get_roles method

The "get_roles" method joins from user to role to pull a list of roles for a given user id. Since the data it returns is specific to a user it's in the user model and called using $this->user->get_roles( $user_id ).
Reply


Messages In This Thread
RE: At what point do you seperate things into different models? - by spjonez - 06-20-2016, 11:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB