[ 'class' => SlugBehavior::className(), 'action' => 'brand/view', 'params' => [ 'id' => 'brand_id', ], 'fields' => [ 'title' => \Yii::t('catalog', 'Brand title'), 'description' => \Yii::t('catalog', 'Brand description'), ], ], ]; } /** * @inheritdoc */ public function rules() { return [ [ [ 'title', ], 'required', ], [ [ 'description' ], 'string', ], [ [ 'title', 'aliasValue', ], 'string', 'max' => 255, ], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'brand_id' => Yii::t('catalog', 'Brand ID'), 'language_id' => Yii::t('catalog', 'Language ID'), 'title' => Yii::t('catalog', 'Title'), 'alias_id' => Yii::t('catalog', 'Alias ID'), 'description' => Yii::t('catalog', 'Description'), ]; } /** * @return \yii\db\ActiveQuery */ public function getAlias() { return $this->hasOne(Alias::className(), [ 'id' => 'alias_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getBrand() { return $this->hasOne(Brand::className(), [ 'id' => 'brand_id' ]) ->inverseOf('brandLangs'); } /** * @return \yii\db\ActiveQuery */ public function getLanguage() { return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } }