Подскажите, что не правильно делаю? Нужно вывести связанные данные из профиля...
Контроллер/**
* Lists all Awards models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new AwardsSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
Вывод<?php foreach ($dataProvider->getModels() as $award):?>
<div class="awards-index-card col-sm-4">
<div class="awards-index-img">
<a href="<?= yii\helpers\Url::to(['/awards/view','id'=> $award->id])?>">
<img class="img-responsive" src="<?=$award->getFullImgUrl()?>">
</a>
<div class="awards-social">
<?php
if ($award->profile->vk){
echo Html::a('<i class="fa fa-vk"></i>',$award->profile->vk, ['target'=>'_blank']);
}
if ($award->profile->instagram) {
echo Html::a('<i class="fa fa-instagram"></i>', $award->profile->instagram, ['target'=>'_blank']);
}
?>
</div>
</div>
<div class="awards-info">
<a href="<?= yii\helpers\Url::to(['/awards/view','id'=> $award->id])?>">
<!--<div class="awards-index-title"><?/*=$award->profile->getFullName()*/?></div>-->
</a>
<div class="awards-index-nomination"><?=$award->nomination->name?></div>
<div class="awards-index-year"><?=$award->year?> </div>
</div>
</div>
<?php endforeach; ?>
Не получается вывести по связи
$award->profile->vk
, а вот
$award->nomination->name
выводит