title: Yii Activerecord doesn't join with nested relation
body: <p>I have defined the following criteria in Yii, and tries to use it to fetch an array of customers.</p>
  
  <pre><code>$criteria = new CDbCriteria(array(
          "condition"=&gt;"hidden = 0".(Yii::app()-&gt;user-&gt;GetState('is_admin') ? "" : " AND franchisesMunicipalities.franchise_id=".Yii::app()-&gt;user-&gt;getState('fid')),
          "with" =&gt; array('municipality','municipality.franchisesMunicipalities')
  ));
  $customers = Customers::model()-&gt;findAll($criteria);
  </code></pre>
  
  <p>This (i thought) should result in that Yii joined the table Customers with the table Municipalities, and then in the same query join the table Municipalities with the table Franchises_Municipalities. However it doesn't work since it doesn't join franchisesMunicipalities.</p>
  
  <p>The resulting query is this</p>
  
  <pre><code>SELECT `t`.`id`                   AS `t0_c0`, 
     `t`.`municipality_id`      AS `t0_c1`, 
     `t`.`personal_code_number` AS `t0_c2`, 
     `t`.`name`                 AS `t0_c3`, 
     `t`.`adress`               AS `t0_c4`, 
     `t`.`zip`                  AS `t0_c5`, 
     `t`.`phone`                AS `t0_c6`, 
     `t`.`mobile`               AS `t0_c7`, 
     `t`.`email`                AS `t0_c8`, 
     `t`.`hidden`               AS `t0_c9`, 
     `municipality`.`id`        AS `t1_c0`, 
     `municipality`.`county_id` AS `t1_c1`, 
     `municipality`.`name`      AS `t1_c2` 
  FROM   `customers` `t` 
     LEFT OUTER JOIN `municipalities` `municipality` 
                  ON ( `t`.`municipality_id` = `municipality`.`id` ) 
  WHERE  ( hidden = 0 
       AND municipality.franchisesmunicipalities.franchise_id = 7 ) 
  LIMIT  30 
  </code></pre>
  
  <p>As you can see it only joins on one relation. The relations in the model should be correctly defined, since i am able to use them in other contexts.</p>
  
  <p>Why doesn't this work?</p>