Reputation: 2149
I do understand the concept of the Observer Pubsub and MVC pattern. I use it in jQuery for instance. Symfony documentation also seems decent, so the usage of the component isn't really an issue but the concept is kinda confusing for me. Could you point some real-life examples (dummy code would be awesome) of using this pattern in Symfony? Can I use it in several different controllers or controller's methods only?
Upvotes: 2
Views: 736
Reputation: 15002
I think Form.php is a good example. If you look at bind method (which is called during bindRequest
method call) it dispatches various events. For info about those events take a look at this answer. Also check this cookbook entry for adding event listener.
Edit: It seems there is a cookbook section on event dispatcher. Check here.
Upvotes: 1
Reputation: 2392
I think you should go through
https://github.com/beberlei/AcmePizzaBundle
it shows you how to build forms using form builder and interact with the database.
Upvotes: 0