FriendsOfSymfony/FOSUserBundle — pull request #1288 by christickner (2013-09-27 16:05:53+00:00)
Title: [Flash Notifications] make registering the FlashListener configurable

Sometimes I do not want to display flash messages to the user after registration in a project. More importantly, I often want more custom control over the notifications I send to the user (beyond just changing a translation file). FOSUserBundle fires events, so I already have control over this.

Problem: Currently its not possible to replace the FlashListener. You are stuck with the FOSUserBundle implementation (which is a good for a default implementation in general).

Solution: We could expose a parameter allowing a replacement of the class. But a much better option is to just offer the ability to not register the FlashListener in the container during compilation. This class has the single responsibility of setting flash messages, so it directly translates to a configuration option. A user can disable FOSUserBundle flash notifications and then optionally implement their own however they see fit.

This PR is an attempt to solve the problem with the above solution. It is BC because the defaults are still the same.