Hey guys,
I want to generate via
a form based on my model:
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "house".
*
* @property integer $id
* @property string $title
*
* @property Image[] $images
*/
class House extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'house';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['title'], 'required'],
[['title'], 'string', 'max' => 100]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'title' => 'Title',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getImages()
{
return $this->hasMany(Image::className(), ['house_id' => 'id']);
}
}
?>
After I run my command, Gii gives me the following error:
Same behaviour, if I remove the method for the foreign key:
/**
* @return \yii\db\ActiveQuery
*/
public function getImages()
{
return $this->hasMany(Image::className(), ['house_id' => 'id']);
}
The model class was generated by Gii itself.
Could anybody please provide me a hint for what I am doing wrong? Help would be appreciated.
Thanks.