Find file
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (39 sloc) 1.64 KB
Copyright (c) 2009, AF83, All rights reserved
You can ask for help and/or improvements or just say hi on the channel
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