title: Datamapper (Overzealous Edition), Codeigniter and Has Many Clarification
body: <p>Firstly, I would like to just it out there that I am an ORM noob. I've never used an ORM in my life and have reached a point in my day-to-day developing that I need to do some crazy advanced relationships that I believe Datamapper Overzealous Edition can help me with as I am using Codeigniter.</p>
  
  <p><strong>In my database I have the following tables;</strong></p>
  
  <p>users<br>
  projects<br>
  clients<br>
  tasks</p>
  
  <p><strong>Here is my desired relationships between the tables;</strong></p>
  
  <ul>
  <li>A user can belong to many projects.</li>
  <li>A project can have multiple tasks, but can only have one client.</li>
  <li>A client can have many users and can have many projects</li>
  <li>A task can only have one project</li>
  </ul>
  
  <p>I have attempted to set-up my models in the models directory as it says in the documentation the model name without the s on the end, so for users I have a user.php model and so on.</p>
  
  <p>I know the documentation is great, but I just can't seem to understand it properly even though it is obviously very easy. I know you instantiate the model by going for example $u = new User(); inside of your controller, but my question is setting up the relationships inside of the models.</p>
  
  <p>How do I set out my models to have the above relationships so for example when I fetch a task I can see what project it belongs to and a whole heap of information from its associated database tables.</p>
  
  <p>I noticed that in the documentation you use the following inside of the projects model which should tell it that it can have more than one task for a project;  <code>var $has_many = array('task')</code></p>
  
  <p>Is that all there is to it? Is it as simple as defining the $has_many and $has_one variables and putting in the associated model name in the array?</p>