title: Yii: how to show a field from a related table's related table?
body: <p>Sorry ... my english is bad, so my question could be absolutely not clear.</p>
  
  <p>I have this tables:
  Groups
  Users
  Reports</p>
  
  <p>Relations:
  <strong>Groups 1 -> N Users 1 -> N Reports</strong></p>
  
  <p>In the <strong>admin view</strong> of report I'm using a <strong>CGridView</strong>.</p>
  
  <p>i'm actually able to show user name. ... but what about show group.name ?</p>
  
  <p>How to setup relations ?
  How to setup CDbCriteria ?</p>
  
  <p><strong>I already have this relation</strong> In Report model:</p>
  
  <pre><code>'user' =&gt; array(self::BELONGS_TO, 'Users', 'userId'),
  </code></pre>
  
  <p>And this in User model</p>
  
  <pre><code>'group' =&gt; array(self::BELONGS_TO, 'Gruppi', 'groupId'),
  </code></pre>
  
  <p>In Report Model I have this:</p>
  
  <pre><code>$criteria=new CDbCriteria;
  $criteria-&gt;with = array ('user');
  </code></pre>