<?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>Mon, 20 May 2013 11:21:33 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Court Ewing's Blog: The Best Models are Easy Models]]></title>
      <guid>http://www.phpdeveloper.org/news/14492</guid>
      <link>http://www.phpdeveloper.org/news/14492</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Court Ewing</i> talks about what he sees as one of the most important parts of any framework-based application - <a href="http://epixa.com/2010/05/the-best-models-are-easy-models">good, easy models</a> that are simple to use and well structured.
</p>
<blockquote>
By treating your models as nothing more than a place to dump your data, you are doing yourself and your application a severe disservice; your business logic is going to be scattered throughout the rest of your application, and you will have a progressively more difficult time as you try to maintain and build upon your existing system. Do not fall into the <a href="http://www.martinfowler.com/bliki/AnemicDomainModel.html">anemic model</a> trap.
</blockquote>
<p>
He gives examples of good models (based on how <a href="http://www.doctrine-project.org/documentation/2_0/en">Doctrine 2</a> handles them) to work with the data for a sample blogging application. His main "Article" model pulls from an abstract one to help define some relationships and magic methods to handle class properties in a protected and private way, depending on the context. He finishes the post with an example of how to use these new model classes to interact with his blog data.
</p>]]></description>
      <pubDate>Mon, 10 May 2010 15:51:57 -0500</pubDate>
    </item>
  </channel>
</rss>
