[ 'class' => SlugBehavior::className(), 'action' => 'shop/view', 'params' => [ 'id' => 'shop_id', ], 'fields' => [ 'title' => \Yii::t('stock', 'Title'), 'description' => \Yii::t('stock', 'Description'), 'address' => \Yii::t('stock', 'Address'), ], ], ]; } public function rules() { return [ [['shop_id', 'language_id', 'title'], 'required'], [['shop_id', 'language_id', 'alias_id'], 'integer'], [['description'], 'string'], [['title'], 'string', 'max' => 255], [['address'], 'string', 'max' => 255], [['alias_id'], 'unique'], [['alias_id'], 'exist', 'skipOnError' => true, 'targetClass' => Alias::className(), 'targetAttribute' => ['alias_id' => 'id']], [['language_id'], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), 'targetAttribute' => ['language_id' => 'id']], [['shop_id'], 'exist', 'skipOnError' => true, 'targetClass' => Shop::className(), 'targetAttribute' => ['shop_id' => 'id']], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'shop_id' => 'Shop ID', 'language_id' => 'Language ID', 'title' => \Yii::t('stock', 'Title'), 'alias_id' => 'Alias ID', 'description' => \Yii::t('stock', 'Description'), 'address' => \Yii::t('stock', 'Address'), ]; } /** * @return \yii\db\ActiveQuery */ public function getAlias() { return $this->hasOne(Alias::className(), ['id' => 'alias_id']); } /** * @return \yii\db\ActiveQuery */ public function getLanguage() { return $this->hasOne(Language::className(), ['id' => 'language_id']); } /** * @return \yii\db\ActiveQuery */ public function getShop() { return $this->hasOne(Shop::className(), ['id' => 'shop_id']); } }