title: Yii2 render two models on one view
body: <p>Yii is the best but I'm having a wee bit of trouble replicating some of the code from yii1 to yii2, below I use the code in yii to render two models in one view and would like to replicate this using yii2. Grateful for any help. thanks</p>
  
  <pre><code>VwContractDetailsController
  
  public function actionView($id)//create new dataprovider and pass param from url
      {
          $events=$dataProvider=new CActiveDataProvider('VwContractEvents', array(
              'criteria'=&gt;array(
                  'condition'=&gt;'Contractkey_id=:aid',
                  'params'=&gt;array(':aid'=&gt;$id)
                  ),
                  'pagination'=&gt;array( 
              'pageSize'=&gt;2
              ),
                  'sort' =&gt; array(
          'defaultOrder' =&gt; 'EventDate DESC', 
      ),
              ));
  
  $this-&gt;render('view',array(
              'model'=&gt;$this-&gt;loadModel($id),
              'events'=&gt;$events,
  
          ));
      }
  
  
  
  vwContractEvents Index //provide full path for itemview
  
  &lt;?php $this-&gt;widget('zii.widgets.CListView', array(
      'dataProvider'=&gt;$dataProvider,
      'itemView'=&gt;'/vwcontractevents/_view',
      'enablePagination' =&gt; true,
  
  
  
  )); ?&gt;
  
  
  vwContractDetails view //render VwcontractEvents/index on vwContractDetails view
  
  &lt;?php
   $this-&gt;renderPartial('/VwContractEvents/index',array('dataProvider'=&gt;$events));
  ?&gt;
  </code></pre>