title: Kohana-v3 ORM parent relationship
body: <p>I just started with the version 3 of the Kohana Framework.
  I have worked a little with the $_has_many etc.</p>
  
  <p>Now I have the table pages. The primary key is pageID. The table has a column called parentPageID. Now I want to make a ORM model who, when accesed like this <code>$page-&gt;parent-&gt;find()</code> returns the page identified by parentPageID.</p>
  
  <p>I have the following already:</p>
  
  <pre><code>// Settings
  protected $_table_name  = 'pages';
  protected $_primary_key = 'pageID';
  protected $_has_one = array(
      'parent' =&gt; array(
          'model'     =&gt; 'page',
          'foreign_key'   =&gt; 'parentPageID',
      ),
  );
  </code></pre>
  
  <p>But that does not work, it simply returns the first page from the table. Last query says this:</p>
  
  <pre><code>SELECT `pages`.* FROM `pages` ORDER BY `pages`.`pageID` ASC LIMIT 1
  </code></pre>
  
  <p>Does somebody know how to solve this?</p>
  
  <p>I know this can: <code>$parent = $page-&gt;parent-&gt;find($page-&gt;parentPageID);</code> but it must be and can be cleaner (I think).</p>
  
  <p><strong>Solved</strong>, see my answer below.</p>