title: Using yii relations to get data across different models
body: <p>I'm still new to Yii, but I'm trying to use relations() to join two tables and get all data from both table on each row pulled.</p>
  
  <pre><code>tables:
  TABLE Artist KEYS(artist_Id, firstName, lastName)
  TABLE Album KEYS(album_Id, title, artist_Id, genre)
  
  // Album
  public function relations()
  {
      return array(
          'artist' =&gt; array(self::BELONGS_TO, 'Artist', 'artist_Id'),
          'track' =&gt; array(self::HAS_MANY, 'Track', 'track_Id')
      );
  }
  
  // Artist
  public function relations()
  {
      return array(
          'album' =&gt; array(self::HAS_MANY, 'Album', 'album_id')
      );
  }
  
  // logic for getting information
  $dataProvider=new CActiveDataProvider('Album');
  foreach($dataProvider-&gt;getData() as $key){
      echo  '&lt;br&gt;' . $key-&gt;artist_Id;  // does work
      echo  '&lt;br&gt;' . $key-&gt;firstName; // doesn't work
  } 
  </code></pre>
  
  <p>With this code, I can get and display the correct artist_Id for the album. However, I want to display the artist firstName and lastName with the artist_Id.</p>