Welcome Guest, Not a member yet? Register   Sign In
question about writing model
#1

[eluser]dexcell[/eluser]
hello, i would like to ask if my approach of writing is correct.

i have 2 models, let's name it entries_model and groups_model

entries_model do the low handling to entries table.
groups_model do the low handling to group table.

then in one of functions of entries model, it needs to connect to group table to check something,

the question:
should i write (connecting to group table manually) in one of entries_model function? or should i just load group_model and call the method?

for illustration (if i load the group_model, it works tough i don't know if it's correct way since i'm new to CI):

Code:
class Entries_model extends Model
{
  function Entries_model()
  {
    parent::Model();
    
    $this->load->model('groups_model');
  }

  function checkSomething()
  {
    $this->groups_model->checkSomething(1);
  }
}


Messages In This Thread
question about writing model - by El Forum - 10-22-2008, 10:02 AM
question about writing model - by El Forum - 10-22-2008, 04:25 PM
question about writing model - by El Forum - 10-22-2008, 09:39 PM
question about writing model - by El Forum - 10-22-2008, 09:54 PM
question about writing model - by El Forum - 10-23-2008, 07:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB