Closed gondik closed 5 years ago
Ideal, collision free naming of events look like this public const NAME = self::class;
, so it would be just partial sollution.
Could you show an code example where multiple events could be processed with same method?
Imho this is usually solved by a command bus pattern and also, this package should be just integration of symfony events, which does not add so complicated features.
Not enough info, closing
Proposal
I've been thinking about potentially useful feature to subscribe to multiple events at once.
Something like this:
public function getSubscribedEvents() { return [ '*' => 'processEvent' ]; }
Eventually, the events can be subscribed by namespace/regular:
public function getSubscribedEvents() { return [ 'order.*' => 'processOrderEvent' ]; }
Can this be simply achieved through the Symfony events core?
Use case (example)
I am working on a large scale ERP system with many services and models and currently I am implementing "newsfeed" feature which will create records by various events of the services and models. So far I need to create subscriber line for every event separately. Feature like this can simplify this approach a lot.