framework/base/Behavior.php
public function attach($owner)
    {
        $this->owner = $owner;
        foreach ($this->events() as $event => $handler) {
            $owner->on($event, is_string($handler) ? [$this, $handler] : $handler);
        }
    }
public function attach($owner)
    {
        $this->owner = $owner;
        foreach ($this->events() as $event => $handler) {
            $owner->on($event, is_string($handler) ? [$this, $handler] : $handler);
        }
    }
Attaches the behavior object to the component.
The default implementation will set the [[owner]] property
and attach event handlers as declared in [[events]].
Make sure you call the parent implementation if you override this method.
@param Component $owner the component that this behavior is to be attached to.