title: Object of class yii\db\ActiveQuery could not be converted to string
body: <p>I'm trying to print data with the help of kartik mPDF. The detailview part is printing without any issue. But I need to print some lines along with the detailview. Now I need to pass data from the model to the view to be printed. I'm trying to do that but not so sure. Currently I'm getting error - </p>
  
  <pre><code>Object of class yii\db\ActiveQuery could not be converted to string
  </code></pre>
  
  <p>I may be wrong in my approach. But please tell me what correction needs to be done. This is the same question as - <a href="https://stackoverflow.com/questions/38318879/how-to-pass-data-from-model-to-a-view-in-yii2/38319827?noredirect=1#comment64266352_38319827">How to pass data from model to a view in yii2</a> </p>
  
  <p>Code of Controller Action - </p>
  
  <pre><code>public function actionPrintsalarystatement($id) {
  
          //Yii::app()-&gt;params['period'] = $period;
          //$s_period = $this-&gt;originalperiod;
          $period = Salary::find()-&gt;select(['s_period'])-&gt;where(['s_id' =&gt; $id])-&gt;asArray();
          //$period = Yii::$app-&gt;request-&gt;post('period');
          //$this-&gt;period = Salary::find()-&gt;select(['s_period'])-&gt;where(['s_id' =&gt; $id]);
          //$period = ArrayHelper::map(Salary::find($id)-&gt;select(['s_period'])-&gt;asArray()-&gt;all(), 's_period', 'period'),
          //$model =  Salary::find()-&gt;where(['s_period' =&gt; $period]);
          $model = $this-&gt;findModel($id);
          $searchModel  = new SalarySearch();
          $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);
          $data         = Salary::findOne($id);
          $content = $this-&gt;renderPartial('_printSalarystatement', [
              'model' =&gt; $model,
              'dataProvider' =&gt; $dataProvider,
              'searchModel'  =&gt; $searchModel,
              'data'=&gt; $data,
              'period' =&gt; $period,
  
              ]);
          $pdf = new Pdf([
              'mode'=&gt; Pdf::MODE_UTF8,
              'format'=&gt; Pdf::FORMAT_A4,
              'destination'=&gt; Pdf::DEST_BROWSER,
              //'destination' =&gt; Pdf::DEST_DOWNLOAD,
              'cssFile' =&gt; '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
              // any css to be embedded if required
              'cssInline' =&gt; '.kv-heading-1{font-size:18px}', 
               // set mPDF properties on the fly
              'options' =&gt; ['title' =&gt; 'Print Payslip'],
               // call mPDF methods on the fly
              'methods' =&gt; [
                  'SetHeader'=&gt;['Private and Confidential'], 
                  'SetFooter'=&gt;['This Payslip is computer generated.'],
              ],
              'content' =&gt; $content,
  
          ]);
          return $pdf-&gt;render();
          //return $this-&gt;render('_printSalarystatement', ['s_period' =&gt; $s_period]);
  
      }
  </code></pre>
  
  <p>Updated view.php</p>
  
  <pre><code>    &lt;?php
  
  use yii\helpers\Html;
  use yii\widgets\DetailView;
  use yii\web\View;
  
  /* @var $this yii\web\View */
  /* @var $model frontend\modules\salary\models\Salary */
  //@var $model yii\base\Model
  //@var $totaldays any
  
  //$this-&gt;title = $model-&gt;s_id;
  //$this-&gt;period = $model-&gt;s_period;
  $this-&gt;params['breadcrumbs'][] = ['label' =&gt; 'Salaries', 'url' =&gt; ['index']];
  $this-&gt;params['breadcrumbs'][] = $this-&gt;title;
  ?&gt;
  &lt;div class="salary-view"&gt;
  
  
      &lt;h1&gt;&lt;strong&gt;&lt;p class="text-center"&gt;My Company&lt;/p&gt;&lt;/strong&gt;&lt;/h1&gt;
      &lt;p class="text-center"&gt;Pay Slip for the month of &lt;?php $model['s_period'];?&gt; &lt;/p&gt;
  
      &lt;?= DetailView::widget([
          'model' =&gt; $model,
          'attributes' =&gt; [
              's_id',
              's_date',
              's_period',
              's_empid',
              's_empname',
              's_workingdays',
              's_leave',
              's_holiday',
              's_wageperday',
              's_totalwage',
              's_ovthour',
          ],
      ]) ?&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>What I'm trying to do -
  <a href="https://i.stack.imgur.com/tu3Ju.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tu3Ju.jpg" alt="enter image description here"></a></p>
  
  <p>Currently I'm getting
  <a href="https://i.stack.imgur.com/V54L9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V54L9.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/XR2d8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XR2d8.jpg" alt="enter image description here"></a></p>