Welcome Guest, Not a member yet? Register   Sign In
RapidDataMapper, a new Object-Relational-Mapper
#1

[eluser]m4rw3r[/eluser]
RapidDataMapper

I've finally managed to get my new Object-Relational-Mapper to a stage where I can release it to the public. It has taken a long time, but finally I also have a complete? manual ready (over 26k words, it was a bit of a pain to write).

RapidDataMapper is both a stand alone Object-Relational-Mapper and a mapper which can be integrated into different frameworks. I have made it CodeIgniter-compatible as a first step, but other frameworks will also follow (when I or someone else has time to create compatibility files, making it officially compatible).

The CodeIgniter specific variant replaces the $this->db object with the main connection object of RapidDataMapper, this to make it easier to use. But you can also skip replacing it (by modding the supplied MY_Loader.php) if you want to be able to use both simultaneously.

RapidDataMapper is based on the DataMapper pattern, and I have taken this to the "extreme" by completely decoupling the objects from the mapper and hiding the mappers behind a proxy object. Compared to IgnitedRecord (my previous ORM), RapidDataMapper does not affect the model, at all. Instead the model is supposed to do what it always has done: fetching and storing data. RapidDataMapper is a tool which is to be used *by* the model to simplify database interaction (it is not strictly so, you can use it in the controller or even in the view, but it "makes more sense" to place all db interaction in a few select files).

A somewhat new idea which I use in RapidDataMapper is the Descriptors. They are objects which describe how the objects should be mapped to the database, which columns that map to properties etc. They can be extended and modified in innumerable ways, making it possible to create your own defaults and override normal behaviour of the mappers.

RapidDataMapper uses an autoloader to load the files, and they are stored in the directory application/data_model/ with the name of the class + .php.

Example usage:
Code:
// application/data_model/user_obj.php
<?php
class User_obj
{
    public $name;
    public $id;
}

// application/data_model/user_objdescriptor.php
class User_objDescriptor extends Db_Descriptor
{
    function __construct()
    {
         $this->setClass('User_obj');
         $this->setSingular('user'); // this makes the other default adjust themselves, eg. table becomes users

         $this->add($this->newPrimaryKey('id'));
         $this->add($this->newColumn('name'));
    }
}

// Usage:

$u = new User_obj();    // the User_obj class is autoloaded

$u->name = 'Martin';

Db::save($u);    // here is the "magic" done

echo $u->id;

$u = Db::find('User_obj', 1);

echo $u->name;
That was just a very very simple example of the usage of RapidDataMapper, it is capable of a lot more.

RapidDataMapper is extremely configurable but it is still aimed to be easy: It assumes a lot of defaults but you can replace almost any of them. By using a code builder and mapper cache can RapidDataMapper really be rapid: only a few files needs to be loaded once the mapper has been built.

Suggestions and comments are extremely welcome!
(and I'm happy to help people start with it, but check the manual first, it should cover the most of it)

Link: http://www.rapiddatamapper.com


Messages In This Thread
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-13-2009, 07:24 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-14-2009, 03:12 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-14-2009, 07:42 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-14-2009, 10:40 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-14-2009, 10:49 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-14-2009, 11:34 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-15-2009, 03:38 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-15-2009, 11:42 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 01:07 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 01:22 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 01:47 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 01:59 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 02:02 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 02:54 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 02:57 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 03:19 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 03:38 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 03:57 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 04:54 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 04:58 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 05:07 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-17-2009, 08:54 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-18-2009, 05:44 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-18-2009, 08:11 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-20-2009, 10:18 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-20-2009, 06:15 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-21-2009, 07:45 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-21-2009, 09:15 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-21-2009, 09:17 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-21-2009, 09:43 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-21-2009, 10:16 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-22-2009, 04:03 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-23-2009, 08:25 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-24-2009, 08:26 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-24-2009, 08:35 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-29-2009, 11:51 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-29-2009, 01:37 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-30-2009, 08:15 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-30-2009, 10:16 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 12-31-2009, 05:16 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 01-04-2010, 03:24 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 01-04-2010, 04:13 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 01-04-2010, 04:22 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 01-04-2010, 05:01 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 01-08-2010, 03:09 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 01-16-2010, 07:25 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 01-16-2010, 07:35 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 02-05-2010, 01:33 PM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 02-20-2010, 07:18 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 02-20-2010, 07:28 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 03-03-2010, 03:46 AM
RapidDataMapper, a new Object-Relational-Mapper - by El Forum - 03-04-2010, 09:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB