【发布时间】:2014-06-05 11:01:19
【问题描述】:
为什么调度事件在我的控制器之后触发?
onBootstrap:
$sharedManager->attach('*', '*', function($e) {
Debug::dump($e->getName());
});
索引操作:
$this->getEventManager()->trigger(__FUNCTION__ . '.pre', $this);
Debug::dump('indexAction do...');
$this->getEventManager()->trigger(__FUNCTION__ . '.post', $this);
结果是:
string(5) "route"
string(15) "indexAction.pre"
string(17) "indexAction do..."
string(16) "indexAction.post"
string(8) "dispatch"
string(8) "dispatch"
string(6) "render"
string(8) "renderer"
string(13) "renderer.post"
string(8) "renderer"
string(13) "renderer.post"
string(8) "response"
string(6) "finish"
string(12) "sendResponse"
我找到了调度过程: https://docs.google.com/drawings/d/1OwFfjgaiXDuKmS2I8nnJNFqoDgEWNNB-_-tUXUPVrgQ/edit 但是好像不正确
我以为dispatch事件会被触发为dispatch.pre,而不是dispatch.post...
【问题讨论】:
-
有趣;刚刚试了一下,得到了相同的结果。
标签: events zend-framework2 dispatch