title: Print all values of an array in CDetailView Yii
body: <p>I'm currently new to Yii and have some problems in my app.</p>
  
  <p>I have 2 AR (Employee and Children) with the relations is Employee has_many Children. Now when we go into the view of Employee (in the view&amp;id=blablabla not in index), I want to list all the children that the Employee have.</p>
  
  <p>I have made a function in EmployeeController class to retrieve the children from my db</p>
  
  <pre><code>$anak = Anak::Model()-&gt;findAll(array(
                              'condition'=&gt;'id_karyawan=:id_karyawan',
                              'params'=&gt;array(':id_karyawan'=&gt;$id_karyawan)));
      //return $anak;
      foreach ($anak as $data){
          return $data-&gt;namaanak;
      }
  </code></pre>
  
  <p>the problem is, it only showing 1 data (the first one, to be exact) of the children, even though in my db the Employee has 3 children. When I try to count of query result, it's showing 3.</p>
  
  <p>My employee/view is like this</p>
  
  <pre><code>$this-&gt;widget('zii.widgets.CDetailView', array(
  'data'=&gt;$model,
  'attributes'=&gt;array(
      'id_karyawan',
      'nama',
      array(
          'name'=&gt;'idjabatan',
          'value'=&gt;$model-&gt;findByPk($model-&gt;id_karyawan)-&gt;jabatan-&gt;namajabatan,
      ),
      array(
          'name'=&gt;'gaji',
          'value'=&gt;Yii::app()-&gt;numberFormatter-&gt;formatCurrency($model-&gt;findByPk($model-&gt;id_karyawan)-&gt;jabatan-&gt;gaji, 'Rp'),
      ),
      'alamat',
      array(
          'name'=&gt;'ttl',
          'value'=&gt;$model-&gt;tempatlahir.', '.Yii::app()-&gt;dateFormatter-&gt;format("dd MMMM yyyy", $model-&gt;tgllahir),
      ),
      array(
          'name'=&gt;'Istri',
          'value'=&gt;Istri::model()-&gt;getNama($model-&gt;id_karyawan),
          'type'=&gt;'raw'
          ),
      array(
          'name'=&gt;'Anak',
          'value'=&gt;$this-&gt;getAnak($model-&gt;id_karyawan),
          'type'=&gt;'raw'
      )
  ),
  </code></pre>
  
  <p>I have tried to google it, but i couldn't find any working answer :(</p>
  
  <p>PS: karyawan = employee, anak = children.</p>