<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Fri, 24 May 2013 06:10:52 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Jeremy Cook's Blog: Normalising DateTimes with Doctrine Events]]></title>
      <guid>http://www.phpdeveloper.org/news/18147</guid>
      <link>http://www.phpdeveloper.org/news/18147</link>
      <description><![CDATA[<p>
<i>Jeremy Cook</i> has <a href="http://jeremycook.ca/2012/06/24/normalising-datetimes-with-doctrine-events/">written up a new post</a> showing you a method for normalizing the date and time information in your application (DateTime) with the help of Doctrine's own event listeners.
</p>
<blockquote>
The solution we hit on was to leverage <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#listening-to-lifecycle-events">Doctrine's system of event listeners</a> 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.
</blockquote>
<p>
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.
</p>]]></description>
      <pubDate>Wed, 27 Jun 2012 12:44:03 -0500</pubDate>
    </item>
  </channel>
</rss>
