News Feed
Sections




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

Court Ewing's Blog:
The Best Models are Easy Models
May 10, 2010 @ 15:51:57

In a recent post to his blog Court Ewing talks about what he sees as one of the most important parts of any framework-based application - good, easy models that are simple to use and well structured.

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 anemic model trap.

He gives examples of good models (based on how Doctrine 2 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.

0 comments voice your opinion now!
model anemic tutorial easy doctrine


blog comments powered by Disqus

Similar Posts

PHPImpact Blog: 5 great articles on SPL Iterators

Scott Mattocks' Blog: PHP-GTK News #22

Rob Allen's Blog: Quiet around here (Tutorial Translation - Brazillian Portuguese)

Padraic Brady's Blog: Example Zend Framework Blog Application Tutorial - Part 9 PDF Download

DevShed: Handling Entries for a Blogger Built with PHP


Community Events





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


symfony list laravel voicesoftheelephpant tool composer series artisanfiles version language podcast introduction security conference interview framework community opinion release library

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