Tag Archives: setEventManager

Zend Framework 2: How to access event manager from every place

Hello friends, There are many situations where you faced a problem when you are not able to access event manager at some places. This may lead to lengthy code or may be change in the implementation logic. For solving this problem, zend framework 2 provides interface Zend\EventManager\EventManagerAwareInterface. There are two ways: a) You will have… Read More »

Zend Framework 2: Create/Manage Custom Events and Listeners

Hello friends, There are certain situations where we need some specific tasks to be done at some places only instead on entire application. For this, zend framework 2 provides event manager component which allows you to create events and listeners for those events when they occur. One more important point is that create events and… Read More »

Zend Framework 2: Controller specific event management

Hello friends, Today I am going to explain how can we attach events for each controller. If you noticed while creating any controller, we extend controller by abstract class Zend\Mvc\Controller\AbstractActionController which extends abstract class AbstractController. Here we have some important functions in these two abstract class like onBootstrap(), attachDefaultListeners(), setEventManager(), etc.

Thanks :).