Broncha 再次感谢您的回复。但我做了一些不同的事情:
我的订阅者事件
static public function getSubscribedEvents()
{
return array(
'FirstEvent' => 'onMethod1',
'SecondEvent' => 'onMethod2',
);
}
public function onMethod1(FirstEvent $event)
{
if ($event->getResult() == 'ready') {
//code
}
}
public function onMethod2()
{
}
第一事件
class FirstEvent extends Event
{
private $result = 'no ready';
public function setResult()
{
$this->result = 'ready';
}
public function getResult()
{
return $this->result;
}
}
第一个事件监听器
class FirstEventListener
{
public function onFirstEvent(FirstEvent $event)
{
//code
$event->setResult();
}
}
它工作正常:)