Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't get the value of the variable #12

Closed
leyestd opened this issue Apr 5, 2015 · 1 comment
Closed

I can't get the value of the variable #12

leyestd opened this issue Apr 5, 2015 · 1 comment

Comments

@leyestd
Copy link

leyestd commented Apr 5, 2015

mdmunir say

Event::$data not used like that. Its only receive value from on() method. http://www.yiiframework.com/doc-2.0/yii-base-event.html#$data-detail
Create your own event class.

class MyEvent extends Event
{
public $params;
}

// ############
$this->on('event_name',function($event){
echo $event->params;
});

$this->trigger('event_name',new MyEvent(['params'=>'param value']));

If you using Event::$data, its always set to value of parameter on(). http://www.yiiframework.com/doc-2.0/yii-base-component.html#on()-detail

1, $this->trigger(self::EVENT_POSITION_UPDATE, new Event([
'data' => $this->_positions[$position->getId()],
]));
本来想在论坛里问,可是忘了密码了,试了好久都验证码不对,找不回密码
请问上面的用法对不,为什么data为null,取不到数据

I was going to ask in the forums, but I forgot the password

Trying for a long time, the verification code is wrong, I can't get my password back

the above code,is that right? The value of the 'data' is null,

I can't get the values of variables

2,
$this->on(self::EVENT_POSITION_PUT, ['frontend\compoments\Evee','aa'],$this->_positions[$position->getId()]);

像这样用的话是取的到的
In the examples above,I can get the value of the variable

@omnilight
Copy link
Owner

Fixed in version v.1.2.0 by adding CartActionEvent class, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants