Ejemplo n.º 1
0
 /**
  * @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']];
 }
Ejemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPetCategory()
 {
     return $this->hasOne(PetCategory::className(), ['id' => 'pet_category_id']);
 }