title: How to join 2 model with relation when using Yii CActiveDataProvider
body: <p>I want to export data to excel using 2 models. <code>HasilPutusan model and DetilSaksi model.</code></p>
  
  <p>When I used the CActiveDataProvider with Model <strong>HasilPutusan</strong>, I managed to get all the data together with the data relationships that are interrelated with this HasilPutusan models.</p>
  
  <p>And how do I combine the data both by using Model <strong>DetilSaksi</strong>?</p>
  
  <p>My controller :</p>
  
  <pre><code>public function actionCetakjalanperistiwa()
  {
      if(isset($_POST['PrintJaper'])){
          $data = $_POST['id_kecelakaan'];
          if($data==''){
              return false;
          }else{
              $dataProvider=new CActiveDataProvider('HasilPutusan', array(
                  'criteria'=&gt;array(
                      'condition'=&gt;'id_kecelakaan=:id',
                      'params'=&gt;array(':id'=&gt;$data),
                  ),
              ));
          }
          $this-&gt;widget('ext.EExcelView', array(
              'grid_mode'=&gt;'export',
              'title' =&gt; 'Data Jalan Peristiwa',
              'dataProvider' =&gt; $dataProvider,
              'exportType'=&gt;'Excel2007',
              'columns'=&gt;array(
                  'id_hasil_putusan',
                  'id_detil',
                  'id_kapal',
                  'idKapal.nama_kapal',
                  'idKapal.tahun_pembuatan',
                  'idKapal.konstruksi',
                  'idKapal.isi_kotor',
                  'idKapal.tenaga_penggerak_utama',
                  'idKapal.pemilik',
                  'idKapal.nakhoda',
                  'idKapal.awak_kapal',
                  'idKapal.surat_kapal',
              ),
          ));
      }else{
          $this-&gt;render('_japer');    
      }
  }
  </code></pre>
  
  <p>In my tbl_hasil_putusan table, i have a <strong>id_detil</strong> field which I will use to re-do the query to the second table using the DetilSaksi model.</p>
  
  <p>My database :
  <img src="https://i.stack.imgur.com/gDquJ.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/u9kKY.png" alt="enter image description here"></p>
  
  <p>How do I combine the two tables that can be joined so that I can call related (<strong>blue arrow</strong>) data in the second table?</p>
  
  <p>Thanks</p>