title: Relational data fields display in Yii2 Details views
body: <p>I have a Table <code>KHDN</code> references table <code>Loaihinh</code> via foreign key <code>loaihinh_ten</code></p>
  
  <p><strong>Table <code>Loaihinh</code>:</strong></p>
  
  <ul>
  <li>ten int identity primary key; // </li>
  <li>loai varchar(100);</li>
  </ul>
  
  <p><strong>Table <code>KHDN</code>:</strong></p>
  
  <ul>
  <li>...fields</li>
  <li>loaihinh_ten: foreign key references Loaihinh(ten)</li>
  </ul>
  
  <p>What should i do if i want to show <code>Loaihinh</code>. <code>loai</code> instead of the foreign key <code>loaihinh_ten</code> in khdn/views.php <strong>Yii2</strong>:</p>
  
  <pre><code>&lt;?php
  
  use yii\widgets\DetailView;
  
  /* @var $this yii\web\View */
  /* @var $model common\models\Khdn */
  ?&gt;
  &lt;div class="khdn-view"&gt;
  
      &lt;?= DetailView::widget([
          'model' =&gt; $model,
          'attributes' =&gt; [
              'id',
              'ten:ntext',
              'chudautu:ntext',
              'ngaybatdau:ntext',
              'ngayhoanthanh:ntext',
              'giatri:ntext',
              'trangthai_ten',
              'diachi:ntext',
              'ghichu:ntext',
              'loaihinh_ten',
          ],
      ]) ?&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>thanks you so much!!</p>