title: Yii2: Gii-generated attributes in GridView
body: <p>I'm a little bit confused about how Yii2 attributes work. If I have two tables (say <em>tradition, culture</em>) with a one-to-many relationship (i.e. one tradition could be present in several cultures) I could use Gii generated code and get in model <em>Tradition</em> something like <em>@property Culture $culture</em>, so I could use (in <em>Tradition</em> view index):</p>
  
  <pre><code>    &lt;?= GridView::widget([
      'dataProvider' =&gt; $dataProvider,
      'filterModel' =&gt; $searchModel,
      'columns' =&gt; [
          ['class' =&gt; 'yii\grid\SerialColumn'],
  
          'id',
          'traditionname',
          'culture.culturename',
  
          ['class' =&gt; 'yii\grid\ActionColumn'],
      ],
      ]); ?&gt;
  </code></pre>
  
  <p>But what about a many-to-many relationship as in tables <em>tradition, book, aux_tradition_book</em>? Gii would automagically generate a <em>@property Book[] $books</em>, but how to use such an array inside a GridView in order to display a bunch of books referring to the same tradition?</p>
  
  <p>Thanks for any help.</p>