yii\base\ActionFilter::attach PHP Method

attach() public method

public attach ( $owner )
    public function attach($owner)
    {
        $this->owner = $owner;
        $owner->on(Controller::EVENT_BEFORE_ACTION, [$this, 'beforeFilter']);
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function attach($owner)
 {
     if ($owner instanceof Module) {
         $owner->controllerMap[$this->verificationRoute] = ['class' => __NAMESPACE__ . '\\VerifyController', 'viewFile' => $this->viewFile, 'filter' => $this];
         parent::attach($owner);
     } else {
         throw new InvalidConfigException(static::className() . '::$owner must instanceof yii\\base\\Module');
     }
 }