Unlike PHP_UML, Dorm does not belong to any framework. It is therefore possible to use it directly in a PHP application, simply by including the file Dorm.php.
The only requirement is the presence, on your system, of either MDB2 or ADOdb, depending on the abstraction layer you want to use along with the ORM.
Download
The software is available on Sourceforge.
Basic example
Here is the source code:
<?
require_once 'PEAR/Exception.php';
require_once 'MDB2.php';
require_once 'MDB2/iterator.php';
require_once 'dorm.php';
$mdb2 = MDB2::connect('mysql://...');
// Dorm initialization
Dorm::bind(
new Dorm_Model('dorm-mapping.xml'),
Dorm_Session::factory($mdb2)
);
// Definition of the PHP class
Class User {
public $id;
public $first_name;
public $last_name;
}
// Insert
$u = new User;
$u->first_name = 'Robinson';
$u->last_name = 'Crusoe';
Dorm::create($u);
echo "The inserted id was ".$u->id;
// Retrieval
$set = Dorm::select("User", "WHERE last_name LIKE 'Cru%'");
foreach($set as $user)
echo '<br/>'.$user->first_name.' '.$user->last_name;
?>

