News Feed
Sections




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

Jani Hartikainen's Blog:
Creating a simple abstract model to reduce boilerplate code
March 02, 2009 @ 12:07:54

In a new blog post Jani Hartikainen shows how to create an abstract model that you can build on when you need to make a dynamic model for your framework application.

In a usual scenario involving models in PHP, you will have some repeating things: You will usually need getters and setters for the model's properties, you will need to be able to construct the model from an SQL query or such, and you'll also need to write SQL queries for the models.

He builds up the three different parts of the abstract model - the getters/setters, fleshing out the model by defining its properties from array values and creating some dynamic SQL (based on property names).

0 comments voice your opinion now!
biolerplate model dynamic framework getter setter properties sql


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: 2 Beginners Guides I Wish I had when I Started with PHP

Zend Developer Zone: Zend Framework Site Gets Bug Tracker, Source Browser.

Zend Developer Zone: It\'s Framework Roundup Time!

Evan Coury's Blog: Using Zend\Dbs TableGateway & HydratingResultSet to return rows as custom enties

Tobias Schlitt's Blog: Reflecting private properties


Community Events





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


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

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