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

CSS Tricks: Create a Slick iPhone/Mobile Interface from any RSS Feed

PHPEveryDay.com: New Tutorials Posted (Web Content/Networking)

NetTuts.com: An Introduction to Views & Templating in CodeIgniter

DevShed: Completing a Query Processor in PHP

Stefan Mischook's Blog: Object Oriented PHP Tutorial Updated


Community Events

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


php7 install release podcast opinion example interview introduction application conference community laravel language api configure framework performance series symfony2 library

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