ビュー/ search.phpYii2 - 関係
<?php foreach($dataProvider->getModels() as $call){ ?>
<tbody>
<tr>
<td><?=$call->created?></td>
<td><?=$call->call_datetime?></td>
<td><?=$call->call_from?></td>
<td><?=$call->call_to?></td>
<td><?=$call->duration?></td>
<td><?=$call->call_type?></td>
<td><?=$call->extension?></td>
<td><?=$call->callRecFiles->fname?></td>
</tr>
</tbody>
<?php } ?>
関係モデルで/ Call.php
public function getCallRecFiles()
{
return $this->hasOne(CallRecording::className(), ['callref' => 'callref']);
}
コントローラactionSearch
public function actionSearch($id)
{
$cust = new Customer();
Yii::$app->user->identity->getId();
$dataProvider = new ActiveDataProvider([
'query' => Call::find()
->with('customer', 'callRecFiles') // eager loading relations 'customer' & 'callRecFiles'
->where(['custref' => $id])
->limit(10),
'pagination' => false, // defaults to true | when true '->limit()' is automatically handled
]);
return $this->render('search',[
'dataProvider' => $dataProvider,
'cust' => $cust,
]);
}
で非オブジェクトのプロパティを取得しようとすると、ここで間違っているのは何ですか?私は他の同様の質問を閲覧しましたが、すべてがウィジェットやファイル入力を伴うようです。どんな助けもありがとうございます。
エラーは何ですか? –
非オブジェクトのプロパティを取得しようとしています – Kyle
どのモデル - >フィールドにこのエラーがありますか? – scaisEdge