<pedrocorreia.net ⁄>
 

<Learning PHP 5.3 by writing your own ORM ⁄ >




clicks: 130 130 2010-01-12 2010-01-12 goto programacao myNews programacao  Bookmark This Bookmark This


Creating an ORM for PHP is not an everyday task but writing one is a good way to improve your PHP skills, especially if you use some of the additional features PHP 5.3 adds to the language. There are many excellent ORMs (Object Relational Mappings) already in existence and for a real-world project it would probably better to use one of these, but this tutorial uses the task of creating an ORM as a way to take a look at applications for some PHP 5.3 features.

Getting started

We will start out by creating a database schema which we want to access with the ORM. To keep things simple we use the MySQL sample database Sakila, which can be downloaded from their website. The Sakila database is designed to represent a DVD rental store and we will use the film and actor tables for this tutorial. More information about the Sakila database, including installation instructions, can be found on the related pages. For this exercise you will need to install both the schema and the data from the Sakila database.

The next thing we need is a way to access our database. Because we are going to concentrate on writing an ORM and not a complete database layer we will use something that might be already familiar to most people, Zend Framework. Zend Framework already ships with its own ORM, Zend_Db_Table, but we ignore that for now and simply make use of the Zend_Db adapters to access the database.



este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:

http://techportal.ibuildings.com/2010/01/11/learning-php-5-3-by-writin...




Subscribe News RSS  Subscribe News Updates by E-mail





myNews <myNews show="rand" cat="programacao" ⁄>

CSS Sprites + Rounded corners

Yes, I know that there are thousands of tutorials regarding rounded corners with (...)

clicks: 420 420 2008-12-31 2008-12-31 goto url (new window) cssglobe.com/po... goto myNews programacao


Simplifying Ajax-Style Web Development

Below is a link to an article I wrote for the May issue of Computer magazine on (...)

clicks: 514 514 2006-07-14 2006-07-14 goto url (new window) blogs.msdn.com/... goto myNews programacao


Back to Basics: Generics

There are language features that are nothing more than syntactical sugar. For ex (...)

clicks: 346 346 2008-11-24 2008-11-24 goto url (new window) codebetter.com/... goto myNews programacao


Bringing .NET principles to JavaScript

With ASP.NET AJAX, and the libraries that were created revolving that framework, (...)

clicks: 541 541 2007-08-17 2007-08-17 goto url (new window) dreamincode.net... goto myNews programacao


Google Protocol Buffers

Protocol buffers are a flexible, efficient, automated mechanism for serializing (...)

clicks: 400 400 2008-08-28 2008-08-28 goto url (new window) code.google.com... goto myNews programacao


Functional C# - Forward Functional Composition

Before we get going, I wanted to revisit currying because I'm not sure that peop (...)

clicks: 271 271 2009-04-26 2009-04-26 goto url (new window) weblogs.asp.net... goto myNews programacao


3 Easy and Fast CSS Techniques for Faux Image Cropping

This article is a summary of a 3 fast and easy CSS techniques you can use to dis (...)

clicks: 197 197 2009-09-08 2009-09-08 goto url (new window) cssglobe.com/po... goto myNews programacao


Tutorial: An Introduction to Linux CLI

A shell is a command interpreter which allows the user to interact with the comp (...)

clicks: 257 257 2009-04-10 2009-04-10 goto url (new window) tuxarena.blogsp... goto myNews programacao