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

Refulz.com: CakePHP evolves to 2.0

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 11)

PHPBuilder.com: Add NoSQL Data Storage to Your PHP Development with Redis

Ryan Mauger's Blog: Keeping your html valid with Zend Framework, Tidy and Firebug

The Code of a Ninja: Salt, Hash and Store Passwords Securely with Phpass


Community Events





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


unittest series release api language code bugfix wordpress threedevsandamaybe application list community interview library developer podcast configure introduction laravel install

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