title: yii2 get name instead of id
body: <p>hi i have this weird problem. i had a table relation. and i want to view the related table field name instead of id.</p>
  
  <p>here is my model:</p>
  
  <pre><code>public function getQCat()
      {
          return $this-&gt;hasOne(QbCategory::className(), ['id' =&gt; 'q_cat']);
      }
  </code></pre>
  
  <p>here is my view:</p>
  
  <pre><code>&lt;?php echo DetailView::widget([
          'model' =&gt; $model,
          'attributes' =&gt; [
              'q_cat',
              'question:ntext',
              'q_c1:ntext',
              'q_c2:ntext',
              'q_c3:ntext',
              'q_c4:ntext',
              'q_ans:ntext',
          ],
      ]) ?&gt;
  </code></pre>
  
  <p>that 'q_cat' field in view i want to display name instead of id. i tried using 'q_cat.name' but it says (not set).</p>
  
  <p>thanks.</p>