News Feed
Sections




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

Jeremy Cook's Blog:
Normalising DateTimes with Doctrine Events
June 27, 2012 @ 12:44:03

Jeremy Cook has written up a new post showing you a method for normalizing the date and time information in your application (DateTime) with the help of Doctrine's own event listeners.

The solution we hit on was to leverage Doctrine's system of event listeners to help us do the work. Doctrine allows you to register listeners with the entity manager that are called whenever certain events occur. We created an event listener that is triggered on the onFlush event.

Code is included for the event listener they created - a simple "onFlush" event that grabs the current entities from the manager, sets the date/time property to allow it to be changed (via Reflection) and updating it with the new cleaned format.

0 comments voice your opinion now!
normalize datetime doctrine event onflush tutorial


blog comments powered by Disqus

Similar Posts

Hasin Hayder's Blog: Complete oAuth script for Twitter and LinkedIn using PECL oAuth Extension

Christoph Dorn's Blog: Zend Server + FirePHP on AWS

TechTatva.com: [How To] Setup Cherokee with PHP5 FPM

SitePoint PHP Blog: Build a Database with Eloquent, Faker and Flysystem

Developer.com: Doctrine: Object Relational Mapping for Your PHP Development


Community Events

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


configure application library performance podcast introduction community opinion voicesoftheelephpant series php7 release symfony2 interview example part2 conference framework laravel api

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