getSubscribedEvents collected from annotations
mishak87 opened this issue · 3 comments
mishak87 commented
This is reminder as @fprochazka requested. Nothing has been done. And so far it is just lets imagine something better discussion. I probably should have moved it to forum.
<?php
/**
* @Event\Subscriber([<class>])
* <class> is set as default for all handlers
*/
class OnEventListener extends Nette\Object
{
/**
* @Event\Handler([<class>[::]<event>][ <priority>])
* <event> defaults to methods name
* If there is class and event they must be separated by ::.
* Otherwise it is determined by heuristic if argument is event or class.
*/
public function onEvent()
{
// ...
}
}
Majkl578 commented
👎 Use trait for building getSubscribedEvents.
mishak87 commented
I thought about it a bit and IMO it could be done via extension that walks all registered listeners and replaces them with generated extensions with Subscriber interface.
fprochazka commented
Sorry, but it would be out-of-scope #97 (comment)