title: Cakephp HABTM with multiple joins needed
body: <p>I'm very new to Cakephp.  I have all my model associations working fine but this one is stumping me and I haven't found anyone who has solved a similar problem.  Here goes..  </p>
  
  <p>I have 4 tables:  <br />
  <strong>people</strong> </p>
  
  <pre>
  +-----+-------------------+
  | Id  | first_name        |
  +-----+-------------------+
  |   1 | jim               | 
  |   2 | bob               | 
  +-------------------------+ 
  </pre>
  
  <p><strong>facility_project_people</strong>  </p>
  
  <pre>
  +-----+---------------------+-----------+
  | Id  | facility_project_id | person_id |
  +-----+---------------------+-----------+
  |   1 |          5          |     1     |
  |   2 |          6          |     1     |
  |   3 |          7          |     2     |
  +---------------------------+-----------+
  </pre>
  
  <p><strong>facility_projects</strong>  </p>
  
  <pre>
  +-----+-------------+-----------+-----------+
  | Id  | facility_id | project_id|  type_id  |
  +-----+-------------+-----------+-----------+
  |   1 |       1     |     1     |     1     |
  |   2 |       2     |     3     |     2     |
  |   3 |       2     |     5     |     3     |
  +-------------------+-----------+-----------+
  </pre>
  
  <p><strong>projects</strong> </p>
  
  <pre>
  +-----+-------------+
  | Id  | name        |
  +-----+-------------+
  |   1 |  Audit      | 
  |   2 |  Inventory  | 
  |   3 |  Tax        |
  |   4 |  Consulting |
  +-------------------+ 
  </pre>
  
  <p>So I have people who can be involved in many projects per facility<br>
  I'm trying to make a model association to get from Person to the Projects they are involved with.  </p>
  
  <p>The MySQL query would be something like:<br>
  <code>
  SELECT 
      p.first_name,
      pr.name
  FROM <code>people</code> p
  left join <code>facility_project_people</code> fpp 
      ON p.<code>id</code> = fpp.<code>person_id</code>
  left join <code>facility_projects</code> fp 
      ON fpp.facility_project_id = fp.id
  left join <code>projects</code> pr
      ON fp.project_id = pr.id
  </code></p>
  
  <p>Using a hasAndBelongsToMany Assocation, I understand how to get as far as the facility_projects table.   </p>
  
  <pre><code>class Person extends AppModel {
      public $hasAndBelongsToMany = array(
      PersonFacilityProject' =&gt; array(
              'className' =&gt; 'Project',
              'joinTable' =&gt; 'facility_project_people',
              'foreignKey' =&gt; 'person_id',
              'associationForeignKey' =&gt; 'facility_project_id',
          ),
      }
  } 
  </code></pre>
  
  <p>Obviously this doesn't give me what I need  </p>
  
  <p>When viewing a person, I'd like to see related projects, but I'm stumped in how to get to the projects table. I'd like to be able to add another join table and foreign key to the association, but cakephp doesn't seem to allow this.  </p>
  
  <p>I appreciate any insight.</p>