News Feed
Sections




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

DevShed:
Building an ORM in PHP
November 18, 2011 @ 09:45:15

On DevShed today there's a new tutorial showing you how to build a basic ORM layer on top of a MySQL database. It includes all the code you'll need (cut&paste-able, not as a download).

Obviously, with so many ORMs at one's disposal for free, it seems pretty pointless to develop a custom one; are we trying to reinvent the wheel? No, of course not. But if you need to create a simple application that performs a few CRUD operations on some related domain objects and don't want to climb the learning curve of a third-party library, then implementing a custom ORM might make sense. There's alos the educational aspect of the process (yes, learning one or two things never hurts).

They start you off with the creation of the "data persistence layer" (an interface first) to connect to the database, building a MySQL-specific one on top of it. Next up is the data mapper layer making things like "fetch by ID" and the insert/update/delete possible. Their simple example doesn't include anything about ORM relationships, though - just fetching simple rows.

0 comments voice your opinion now!
orm tutorial mysql mapper fetch database


blog comments powered by Disqus

Similar Posts

The Bakery: New Tutorials - PHPTAL, Multiple Checkboxes, and counterCache

DevShed: Working with Images and Text Flows in PDF Files with PHP 5

DevShed: Validating URL Protocols, Hosts and Paths with Filters in PHP 5

Alexy Kovyrin\'s Blog: Nginx With PHP As FastCGI Howto

SitePoint PHP Blog: How to Create a Laravel CSS-Minify Command


Community Events





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


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

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