What is PHP ORM?
PHP ORM consists of two components which work together to streamline the database connection portion of your web site
development. PHP ORM relies on PDO and a collection of classes which encapsulate and simplify tedious database connection
details such as logon credentials, query result set handling, error handling, and object-relational mapping. The components
of PHP ORM (database connections & object-relational mapping) were designed to be used together but it is also possible
and very easy to utilize the database connection portion alone.
How far along is this application?
The project is currently in an early beta status. The major components have all been written and are currently being used
in several working web applications. The application as a framework has not been completely vetted, though, so it is possible
that bugs will be spotted and that new features will be requested / required.
What is Object-Relational Mapping?
Object-Relational mapping is a simple concept which relates databases to classes. The basic gist of a ORM class is that it will
have variables which correspond to each column in a table and methods which can simplify access to this data. Each variable
must have a get_ and set_ method which gets and sets each variable. Each class will have one variable which corresponds to the
primary key in the database. Each class has several methods to handle modification of the data in that class, namely save() and delete().
I don't get it...
Here's a simple example. Let's say that we have a table called "users". (actually, take a look at the sample table ).
Assume that this table has a couple of columns:
id_user
first_name
last_name
email
Look at the example database and click "Generate Class". You can see that this class has the methods that
were just described. Let's go ahead and add a new user to the database:
<php?
// include the User class. Let's assume that it is here:
require_once 'classes/User.php.inc';
$user = new User();
$user->set_first_name('Homer');
$user->set_last_name('Simpson');
$user->set_email('chunkylover53@aol.com');
$user->store();
?>
It's even easier to change something about that user. Let's erase the email from Homer's account:
<php?
$user = new User(1); // Assume Homer's user ID is '1'
$user->set_email('');
$user->store();
?>
Thank you for your interest in PHP ORM! This framework is currently under development and is not yet
ready for the prime-time. Feel free to browse the documentation and check back soon for updates to the
tools, documentation, example uses, etc.