The Behavior class extends Object , but only the Component class has a trigger() method. I would like to be able to sign an event handler that Behavior itself generates, like so

 SomeController extends Controller { public function behaviors() { return [ [ 'class' => MyBehavior::class, 'on someEvent' => // handler ] ] } } 

Maybe there are some ideological reasons, do not do this?

  • Behavior :: events () - not? - Bookin
  • No, these are owner class events, and I would like to do this in the behavior class itself $ this-> trigger () - Oleg Khamov

0