Yet another PHP ORM
Pull request Compare This branch is 3 commits ahead, 17 commits behind moa3:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Copyright (c) 2009, AF83, All rights reserved

Morm is an attempt to create a nice and as powerfull as possible PHP orm.

For now, Morm can handle:

* Simple Object -> Table mapping
* one to one relations
* one to many relations
* many to many relations (still in early alpha stage though)
* polymorphism

thanks to the new Mormulous file, you can now use Morm in a very simple manner.

all you have to do is:

edit Mormulous.php
The minimal config you can do is set the DB_NAME and DB_USER constants.
You can also set the other Constants to match your requirements.

Morm is now Usable.

Let's suppose you have a table named "post" in your database with a field called

You can walk through its content by simply doing



$posts = new Mormons('post');
foreach($posts as $post)
    echo $post->name."\n";


You'll see that Morm will automagically generate a Model file called "post.php" in the MODELS_PATH and use it.

As soon as this model has been generated once, you can edit it at your

Be careful if you have a field called "type" in your table.
Morm will try to use the STI and load a class named after the content of this
field. Eventhough Morm tries to guess things and be nice with you as much as
possible, in this case, if the model Morm is looking for does not exist, it will
If you want to avoid this behavior, just add

        protected $sti_field = NULL;

in the corresponding model

Feel free to ask for improvements