Tag Archives: Event Manager

Zend Framework 2: Shared Event Manager

Hello friends, Today will will discuss the use of Shared Event Manager and Listeners. A Shared Event Listeners is just a listener that has been attached to the Shared Event Manager (SEM) instead of the local Event Manager (EM) instance.

Thanks

Zend Framework 2: Aggregate Listeners

Hello friends, Today we will discuss about the aggregate listeners. The Aggregate Listener is a listener that knows how to attach itself. In order to create an Aggregate Listener, you must use the following classes:  Zend\EventManager\ListenerAggregateInterface;  Zend\EventManager\EventManagerInterface; Step 1: Create a custom class CustomAggregateListeners.php

Step 2: Trigger events having aggregate listeners

Thanks

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 :).