/** * @inheritdoc */ public function rules() { return [[['name'], 'required'], [['description'], 'string'], [['lvl', 'status'], 'integer'], [['name', 'image_path', 'main_image', 'slug'], 'string', 'max' => 256], [['slug'], 'unique'], [['image_path', 'main_image', 'category_image'], 'safe'], ['parent_id', 'exist', 'targetClass' => PetCategory::className(), 'targetAttribute' => 'id']]; }
/** * @return \yii\db\ActiveQuery */ public function getPetCategory() { return $this->hasOne(PetCategory::className(), ['id' => 'pet_category_id']); }