title: Codeigniter 2 + Datamapper ORM: Adjacency Lists, how to set model relation for it?
body: <p>Q: How to set models for Adjacency Lists, when using Datamapper ORM. Anyone experienced ? For example, Table Category ( id, name, has_parent_category_id ). Thanks for looking!</p>
  
  <p>Example table,</p>
  
  <pre><code>Tbl Category
  
  id | name | has_parent_category_id
  1  | catA | 0
  2  | catB | 0
  3  | catC | 1
  4  | catD | 2
  5  | catE | 3
  </code></pre>
  
  <p>The docs are in <a href="http://datamapper.wanwizard.eu/pages/advancedrelations.html" rel="nofollow">http://datamapper.wanwizard.eu/pages/advancedrelations.html</a> and I found the following "Self Relationships". I'm not sure if this is the right way! I'm testing it.</p>
  
  <p>If anyone is experienced with Adjacency lists, codeigniters Datamapper ORM and would mind leaving one practical example on how to do this, I would appreciate it!</p>
  
  <p>Thanks for your time!</p>