News Feed
Sections




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

Kevin Schroeder's Blog:
Zend Framework 2 Event Manager
September 16, 2011 @ 11:40:47

Kevin Schroeder has a new post today sharing some of his experience with the Zend Framework 2 Event Manager in a simple example of pre- and post-validation hooks in a model.

I got to play with the Event Manager. I did like the plugin functionality in ZF1, but it required some pretty static coding. In some cases, like the front controller plugins, it makes more sense (though this way seems more desirable). [...] It's a ZF1 application, but since (it seems) the event manager is self-contained (and the autoloader works with both ZF1 and ZF2) you can simply paste it into your include_path and BOOM, you have an event manager.

In his case he has a set of models extending a base class and wanted to introduce pre- and post-validation hooks to make it simpler to check the data he was working with. He includes the code for his base model class showing how he implemented the ZF2 EventManager in his ZF1 application. He attaches an event to the password class property and, on update, it automatically updates a temporary password value too.

You can get more information on using the EventManager in this other post from Matthew Weier O'Phinney.

0 comments voice your opinion now!
eventmanager zendframework tutorial validation hook


blog comments powered by Disqus

Similar Posts

Beanizer.org: Exposing OpenJMS to PHP

Greebo.net: Converting your PHP app to MySQLi prepared statements

ThinkPHP Blog: Methods to Reduce the Load of Your Webserver by Caching Content

SitePoint PHP Blog: UTF-8 Email in PHP with eZ Components

PHPMac.com: Building and Installing Apache 2.2.2 and PHP 5.1.3 (or 5.1.4) on Mac OS X 10.4.6


Community Events





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


release symfony interview version laravel framework voicesoftheelephpant package podcast update community application tool security library opinion introduction series language composer

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