Welcome Guest, Not a member yet? Register   Sign In
Design Question
#4

[eluser]gtech[/eluser]
yes even a join.. I made a decision not to have a model for the lookup tables (links between many to many relationships), but I grouped functionality for each major table.

For example I may have a function that gets a list of users in a group. I made a decision to put it in the groups model as the query is group centric.

Code:
function get_group_users($groupid)
  {
      // this query might not work just gives you an idea
      $this->db->select('*');
      $this->db->from('group_user_lookups');
      $this->db->join('users','group_user_lookups.UserID = users.UserID');
      $this->db->where('GroupID',$groupid);
      $query = $this->db->get()
      return $query;
  }

sometimes it is a difficult call on which model to put it in. This is how I split my application up, which is quite large (26 datbase tables, 18 models with about 10 functions in each).. but my approach has enabled the application code to grow and remain readable


Messages In This Thread
Design Question - by El Forum - 05-20-2008, 04:48 PM
Design Question - by El Forum - 05-20-2008, 05:11 PM
Design Question - by El Forum - 05-20-2008, 05:35 PM
Design Question - by El Forum - 05-20-2008, 05:51 PM
Design Question - by El Forum - 05-20-2008, 08:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB