title: Is loading a model within another CodeIgniter model appropriate?
body: <p>I have an architectural question that has been bothering me. </p>
  
  <p>Codeigniter defines there <a href="http://codeigniter.com/user_guide/general/models.html" rel="nofollow">model</a> as such.  Now there are times when a model is closely tied to another.  I.e. User and Security.  </p>
  
  <p><strong>Is it bad practice to access another model within a model?</strong>  </p>
  
  <p>i.e. </p>
  
  <pre><code>class User extends CI_model 
  {
      function getUser() 
      {
          $this-&gt;load-&gt;model('User');
          $user = // load user 
  
          $this-&gt;load-&gt;model('Security');
          $security = // load security
  
          $user-&gt;security = $security;
      }
  }
  </code></pre>
  
  <p>Some how it doesn't feel 'kosher' to me.   It feels like I need to have a DAO or some sort of DAL on top which can then load both models and do the necessary fetching while leaving the basic CRUD and model specific operations in the model.  And if we do create a separate layer, there doesn't seem like a logical place to put them in the Codeigniter framework.  </p>