I'm building an app in Symfony2 that has a social-driven aspect (many actions a user performs on the site will show up in a "news feed"-style list for others to view). I've determined that the sf2 event dispatcher/listener system is the best way to handle this, but I've run into something of a snag in trying to configure my listener to handle many different events.
The (now outdated) documentation I've found in my searches seems to indicate that at one point, event listeners could register on multiple events, but the code has been refactored, and now the configuration looks something like this:
config.yml:
services:
social.listener:
class: F\Q\C\N\SocialEventListener
tags:
- { name: kernel.listener, event: onSocialShare }
Is there any way to either:
- Easily pass multiple events (something like
event: [onSocialShare, onSocialFriend, onSocialCreate]
works, but that feels like it will quickly get ugly and unmaintainable, clogging up my config file with potentially dozens of social events - Define the event to which I want to subscribe from code (as was done previously)
- Or possibly another, better option that I haven't thought of yet
Thanks in advance.