<myBlog show="last" ⁄>
<mySnippets order="rand" ⁄>
<myPhoto order="random" ⁄>
<mySnippets type="lang" ⁄>
<myQuote order="random" ⁄>
<myContacts ⁄><email ⁄>
<windows live messenger ⁄>
<myCurriculum type="pdf" ⁄>
<myVisitorsMap ⁄>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...
<myNews show="rand" cat="programacao" ⁄>