News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
An introduction to ZendEventManager
April 23, 2012 @ 09:29:08

Rob Allen has a new post to his blog today introducing you to the ZendEventManager component of the Zend Framework v2, a key part of how this latest version of the framework does its job.

Zend Framework 2's EventManager is a key component of the framework which is used for the core MVC system. The EventManager allows a class to publish events that other objects can listen for and then act when the event occurs. The convention within Zend Framework 2 is that any class that triggers events composing its own EventManager.

He starts with some terminology to get everyone on the same page (listener, event, EventManager) and includes an example of its use in setting up a "PhotoMapper" object showing how to trigger events in the "findById" method. He shows how to listen for a specific event (in his case, a "pre-execute" on the "findById" method) and a method for "short circuiting" the listener based on the response from the "trigger" call. He also touches on the "SharedEventManager" that can be used to add an event across all of your application at the same time.

0 comments voice your opinion now!
introduction zendframework eventmanager trigger event


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Using Zend_Search_Lucene, the PHP Lucene Implementation

Erika Heidi: A beginners guide to Vagrant and Puppet, part 3 - facts, conditionals and modules

Adam Jensen's Blog: Cron tasks in Zend Framework apps

Josh Holmes' Blog: Webinar on Oct 20, 2010 with Microsoft/Zend

Robert Basic's Blog: Starting with Zend Framework


Community Events

Don't see your event here?
Let us know!


composer community introduction podcast yii2 list framework application example series api programming interview php7 opinion language part2 symfony project laravel

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework