June 14, 2016 | No Comments | Programming | doctrine listener Symfony2

Using Doctrine Entity Listeners in Symfony2

Since doctrine 2.4 we can use Entity Listeners to perform operations before/after saving entity in database.  How to use entity listeners in Symfony2 ?  For example we need to log our entity on some condition.

June 3, 2016 | No Comments | Programming | event listener monolog pushover Symfony2

Custom Exception Listener in Symfony2

The common task in web development is handling and monitoring exception with various tools. In this article I can show how to handle and log errors in Symfony2.  For this task we will use our custom exception listener.

For example, we have Pushover Handler in Monolog library and we want to receive push notification about every exception except 404 errors.

January 28, 2016 | 1 Comment | Programming | event listener PHP Symfony2

Custom Events And Event Listeners in Symfony2

All we know that fat controllers is evil in MVC but where we can place additional logic ? One of the solutions in Symfony2 – events and event listeners provided by EventDispatcher Component.