[ 'class' => LanguageBehavior::className(), ], ]; } public function rules() { return [ // [ // [ // 'image', // ], // 'required', // ], [ [ 'status', ], 'boolean', ], [ [ 'sku', ], 'string', 'max' => 255, ], [ [ 'sort', 'image_id', ], 'integer', ], [ ['image_id'], 'exist', 'skipOnError' => true, 'targetClass' => Image::className(), 'targetAttribute' => ['image_id' => 'id'], ], ]; } /** * @return \yii\db\ActiveQuery */ public function getImage() { return $this->hasOne(Image::className(), ['id' => 'image_id']); } }