Ошибка Getting unknown property: app\models\SeoPageTours::id_tour
Возникает она в виджете AutoComplete
Модель
class SeoPageTours extends \yii\db\ActiveRecord
{
public static function tableName()
{
return 'seo_page_tours';
}
public function rules()
{
return [
[['id_seo_page'], 'integer'],
];
}
public function attributeLabels()
{
return [
'id' => 'ID',
'id_tour' => 'Привязанные туры',
'id_seo_page' => 'Сео-страница',
];
}
Крнтроллер
public function actionCreate()
{
$model = new SeoPage();
$modelsSeoPageTours = [new SeoPageTours];
$tourList=Tours::find()->select(['CONCAT(id, " (", name, ")") as value', 'name as label'])->asArray()->all();
return $this->render('create', [
'model' => $model,
'tourList' => $tourList,
'modelsSeoPageTours' => $modelsSeoPageTours,
]);
}
}
Вьюшка
<?php foreach ($modelsSeoPageTours as $indexSeoPageTours => $modelSeoPageTours): ?>
<tr class="tour-similar-item" data-id="<?=$number++?>">
<td class="vcenter">
<?php
if (! $modelSeoPageTours->isNewRecord) {
echo Html::activeHiddenInput($modelSeoPageTours, "[{$indexSeoPageTours}]id");
}
?>
<?= $form->field($modelSeoPageTours, "[{$indexSeoPageTours}]id_tour")->label(false)->widget(
AutoComplete::className(), [
'clientOptions' => [
'source' => $tourList,
],
'options'=>[
'class'=>'form-control'
]
]); ?>
</td>
<td class="text-center vcenter" style="width: 90px;">
<button type="button" class="remove-tour-similar btn btn-danger btn-xs"><span class="glyphicon glyphicon-minus"></span></button>
</td>
</tr>
<?php endforeach; ?>