Yii2 framework backup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

21 lines
376 B

<?php
$obj = new class () extends \yii\base\Component
{
public $foo = 0;
};
$obj->attachBehavior('bar', (new class () extends \yii\base\Behavior
{
public function events()
{
return [
'barEventOnce' => function ($event) {
$this->owner->foo++;
$this->detach();
},
];
}
}));
return $obj;