Пример #1
0
 public function checkBehavior()
 {
     /** @var AttachBehavior $behavior */
     $behavior = $this->getAttachBehavior();
     $class = AttachBehavior::className();
     $name = AttachBehavior::NAME;
     if (!$behavior) {
         throw new InvalidConfigException("Behavior '{$class}' with name '{$name}' does not exists in model");
     }
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors[] = ['class' => AttachBehavior::className(), 'models' => ['avatar' => ['class' => UserAvatarFile::className()]]];
     return $behaviors;
 }