<?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>Thu, 23 May 2013 19:44:39 -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[Rob Allen: Objects in the model layer: Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/19398</guid>
      <link>http://www.phpdeveloper.org/news/19398</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> <a href="http://akrabat.com/development/objects-in-the-model-layer/">previously posted</a> about some of his practices around the different types of objects in the model layer of his Zend Framework 2 applications. In <a href="http://akrabat.com/php/objects-in-the-model-layer-part-2/">this latest post</a> he follows up and shares some example code for the different types.
</p>
<blockquote>
I previously talked about the terms I use for <a href="http://akrabat.com/development/objects-in-the-model-layer/">objects in the model layer</a> and now it's time to put some code on those bones. Note that,as always, all code here is example code and not production-ready.
</blockquote>
<p>
He includes sample classes related to his "books" examples - a "book" entity (with title, author, id and ISBN), a mapper object to load/save/delete the entity and a service object that provides an interface for the entity to the rest of the application.
</p>]]></description>
      <pubDate>Tue, 02 Apr 2013 11:55:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen: Objects in the model layer]]></title>
      <guid>http://www.phpdeveloper.org/news/19350</guid>
      <link>http://www.phpdeveloper.org/news/19350</link>
      <description><![CDATA[<p>
In <a href="http://akrabat.com/development/objects-in-the-model-layer/">this latest post</a> to his site <i>Rob Allen</i> talks some about application structure and the different kinds of objects he uses in his applications.
</p>
<blockquote>
I currently use a very simple set of core objects within my model layer: entities, mappers and service objects. [...] I dislike the phrase "service object" as the word "service" means so many things to so many people. I haven't heard a better phrase yet that everyone understands though.
</blockquote>
<p>
He defines each of the types of objects to help make the separation clearer. Here they are in brief:
</p>
<ul>
<li>Entities are objects that represent something in my business logic.
<li>Mappers know how to save and load an entity from the data store.
<li>Service objects provide the API that the rest of the application uses.
</ul>
<p>
Some of the comments on the post relate his choices to use in Zend Framework v2-based applications, noting that there are some base components you can extend to create these kinds of objects.
</p>]]></description>
      <pubDate>Fri, 22 Mar 2013 10:45:54 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: The MVC Pattern and PHP, Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/19302</guid>
      <link>http://www.phpdeveloper.org/news/19302</link>
      <description><![CDATA[<p>
PHPMaster.com has posted the <a href="http://phpmaster.com/the-mvc-pattern-and-php-2/">second part of their MVC series</a>, introducing you to the Model/View/Controller design pattern. If you want to catch up, part one <a href="http://phpmaster.com/the-mvc-pattern-and-php-1/">is here</a>.
</p>
<blockquote>
Welcome to part 2 of this two-part series discussing MVC and PHP, where we'll discuss some of the considerations one must make when using an MVC architecture. If you've come straight to this article without reading part 1 first, I encourage you to head back and have careful read as this one will assume that you've read and understand everything it discussed.
</blockquote>
<p>
He talks about some of the things more involved in making a MVC framework including routing and URL formats and working with templates. Sample code is included for the route handling, model/controller relationship and view classes for the templates.
</p>]]></description>
      <pubDate>Tue, 12 Mar 2013 11:19:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: The MVC Pattern and PHP, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/19274</guid>
      <link>http://www.phpdeveloper.org/news/19274</link>
      <description><![CDATA[<p>
If you're new to the world of PHP frameworks, there's one acronym that might confuse you if you don't understand the structure - MVC. In <a href="http://phpmaster.com/the-mvc-pattern-and-php-1">this new tutorial</a> on PHPMaster.com today introduces you to the MVC (Model/View/Controller) design pattern and how it's commonly implemented in PHP.
</p>
<blockquote>
The Model-View-Control (MVC) pattern, originally formulated in the late 1970s, is a software architecture pattern built on the basis of keeping the presentation of data separate from the methods that interact with the data. In theory, a well-developed MVC system should allow a front-end developer and a back-end developer to work on the same system without interfering, sharing, or editing files either party is working on. [...] In this article, I will go the basic principles of MVC, a run through the definition of the pattern and a quick example of MVC in PHP. This is definitely a read for anyone who has never coding with MVC before or those wanting to brush up on previous MVC development skills.
</blockquote>
<p>
He starts with an introduction of the overall structure of the pattern, how each part talks with the others. He then talks about each piece in a bit more detail and provides some code examples for some very basic MVC classes. There's no routing or anything connected to them like there would be in a framework - it's just the classes taking the others in as parameters.
</p>]]></description>
      <pubDate>Tue, 05 Mar 2013 13:21:32 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney: RESTful APIs with ZF2, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/19170</guid>
      <link>http://www.phpdeveloper.org/news/19170</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> has posted <a href="http://www.mwop.net/blog/2013-02-11-restful-apis-with-zf2-part-1.html">the first part</a> of a new series he's been working on about creating RESTful APIs with the help of Zend Framework v2. In this part, he looks at things like the "Richardson Maturity Model" and "Hypertext Application Language" as parts of development of the API too.
</p>
<blockquote>
RESTful APIs have been an interest of mine for a couple of years, but due to <a href="http://framework.zend.com/blog//zend-framework-2-0-0-stable-released.html">circumstances</a>, I've not had much chance to work with them in any meaningful fashion until recently. <a href="http://akrabat.com/">Rob Allen</a> and I proposed a workshop for <a href="http://conference.phpbenelux.eu/2013/">PHP Benelux 2013</a> covering RESTful APIs with ZF2. When it was accepted, it gave me the perfect opportunity to dive in and start putting the various pieces together.
</blockquote>
<p>
After going over the "Richardson Maturity Model" for the REST structure he spends the rest of the post looking at HAL ("Hypertext Application Language") structure and examples. He mentions the media types it uses, how it handles links between resources and how to embed a resource into the resulting response.
</p>]]></description>
      <pubDate>Tue, 12 Feb 2013 11:40:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Andrew Podner: Lithium: Getting Stuff From Your Database]]></title>
      <guid>http://www.phpdeveloper.org/news/19030</guid>
      <link>http://www.phpdeveloper.org/news/19030</link>
      <description><![CDATA[<p>
<i>Andrew Podner</i> has a new post for those wanting to find out more about the <a href="http://lithify.me/">Lithium framework</a> and <a href="http://unassumingphp.com/lithium-getting-stuff-from-your-database/">using models</a> to work with your database.
</p>
<blockquote>
Today I want to provide a tutorial on how to do some basic interaction with a database in Lithium, and I am going to rely on MySQL as a database for the purposes of this tutorial, although you have other options like MongoDB, as an example.
</blockquote>
<p>
His example script uses the idea of "blog posts" stored in a MySQL table and code snippets are included showing how to:
</p>
<ul>
<li>Create the model class based off of the core Lithium one
<li>Select all of the records from the table
<li>Filter down the returned values with "magic finder" methods (like "findAllByStatus")
</ul>
<p>
You can find out more about the framework <a href="http://lithify.me/docs">in the project's documentation</a> section of their site.
</p>]]></description>
      <pubDate>Mon, 14 Jan 2013 10:36:31 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Sencha Touch 2 Models - Loading And Saving Model Data Using a Proxy, PHP Example]]></title>
      <guid>http://www.phpdeveloper.org/news/18430</guid>
      <link>http://www.phpdeveloper.org/news/18430</link>
      <description><![CDATA[<p>
On DZone.com there's a new tutorial posted (by <i>Jorge Ramon</i>) about hooking together the models of Sencha's Touch 2 with a PHP backend to make saving data to them simpler via a proxy.
</p>
<blockquote>
Sencha Touch models have the ability to work with a proxy. This feature allows you to save and retrieve model data from the server, memory or local storage, without depending on a Sencha Touch data store. Let's try it with a very simple scenario where the server side is a PHP page.
</blockquote>
<p>
The article includes both the Javascript to create the models (along with its proxy and custom API methods defined) as well as the PHP that powers the backend. The PHP just reads from the "php://input" stream and echoes back out JSON, but it gives you an idea of what to expect to receive. For more information on Sencha Touch, check out <a href="http://docs.sencha.com/touch/2-0/">their documentation</a>.
</p>]]></description>
      <pubDate>Fri, 31 Aug 2012 11:54:19 -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>
    <item>
      <title><![CDATA[NetTuts.com: Build Web Apps from Scratch with Laravel - The Eloquent ORM]]></title>
      <guid>http://www.phpdeveloper.org/news/18153</guid>
      <link>http://www.phpdeveloper.org/news/18153</link>
      <description><![CDATA[<p>
In the second part of their series looking at the <a href="http://laravel.com">Laravel PHP framework</a> and creating your first application with it. In <a href="http://phpdeveloper.org/news/18115">part one</a> you got a brief introduction to creating and configuring an application. In <a href="http://net.tutsplus.com/tutorials/php/build-web-apps-from-scratch-with-laravel-the-eloquent-orm/">part two</a> they dig a little deeper and talk about Laravel's ORM functionality.
</p>
<blockquote>
In this Nettuts+ <a href="http://net.tutsplus.com/tutorials/php/building-web-applications-from-scratch-with-laravel/">mini-series</a>, we'll build a web application from scratch, while diving into a great new PHP framework that's rapidly picking up steam, called <a href="http://laravel.com/">Laravel</a>. In this lesson, we'll be working on an integral part of any web application: the Models. Along the way, we'll learn about Laravel's amazing ORM implementation: Eloquent.
</blockquote>
<p>
The tutorial introduces you to the concept of "Models" and some of the conventions that surround them in the Laravel framework. They show some of the most common operations (CRUD) and how to define relationships between the models (has many, has one, etc). They apply this to their "Instapics" example application, creating the interfaces for the users, profiles, relationships, photos and comments. They include the code to create the controllers/views to go along with them, making a simple interface to show users and their photos.
</p>
<p>
You can find out more about the Eloquent ORM in <a href="http://laravel.com/docs/database/eloquent">this section</a> of the Laravel manual.
</p>]]></description>
      <pubDate>Thu, 28 Jun 2012 12:27:14 -0500</pubDate>
    </item>
  </channel>
</rss>
