<?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>Tue, 21 May 2013 04:20:05 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[MaltBlue.com: Zend Framework 2 - Hydrators, Models and the TableGateway Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/19589</guid>
      <link>http://www.phpdeveloper.org/news/19589</link>
      <description><![CDATA[<p>
<i>Matthew Setter</i> has written up a post to his site that continues his look at the features of Zend Framework 2. This time he's looking specifically at <a href="http://www.maltblue.com/tutorial/zendframework2-hydrators-models-tablegateway-pattern">hydrators, models and the table gateways</a> and their use in connecting your application with a database.
</p>
<blockquote>
One set of features has really been helping me of late ones that really have me smiling; these are: Hydrators, Models and Table Gateways. If you're new to ZF2 or database interaction with frameworks, then you're in a perfect position as today's post will be giving you a good introduction to the basics of using both together.
</blockquote>
<p>
He starts with a look back at how it all was done in ZF1 and shows how using these three components makes for an even better system, allowing the model to be completely data-source agnostic. His examples start with the table gateway class, showing how to connect it with a "users" table. From there he adds in the model (with an "exchangeArray" method) and a hydrator that maps the table columns to the properties on the entity. He shows how to add this setup to the service configuration and its use in a controller, returning a full list of the records in the "user" table.
</p>
Link: http://www.maltblue.com/tutorial/zendframework2-hydrators-models-tablegateway-pattern]]></description>
      <pubDate>Wed, 15 May 2013 11:13:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Evan Coury's Blog: Using ZendDb's TableGateway & HydratingResultSet to return rows as custom enties]]></title>
      <guid>http://www.phpdeveloper.org/news/18161</guid>
      <link>http://www.phpdeveloper.org/news/18161</link>
      <description><![CDATA[<p>
<i>Evan Coury</i> has a new post to his blog about <a href="http://blog.evan.pro/zf2-tablegateway-hydration">using ZendDb's TableGateway</a> (from the Zend Framework 2) along with the HydratingResultSet feature to let you build objects from your database results.
</p>
<blockquote>
The new ZendDb in Zend Framework 2 has a handy feature which allows you to specify your own entity/model class to represent rows in your database tables. This means you can tell ZendDb to return each row as a populated instance of your own custom objects. Keep in mind that this is simply a convenience feature, and not meant to serve as a fully-featured ORM. If you're looking for a full-blown ORM, have a look at <a href="http://www.doctrine-project.org/">Doctrine 2</a>.
</blockquote>
<p>
He includes some example SQL to create a "book" table and the ZF2 code to create the Book model, set up the database connection and generate the hydrated data set from the results. An example of doing an insert into the table and then pull it back out from the TableGateway object.
</p>]]></description>
      <pubDate>Mon, 02 Jul 2012 09:32:55 -0500</pubDate>
    </item>
  </channel>
</rss>
