Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Yet another PHP ORM ...
PHP
tree: 9b5e91bfae

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
conf
doc
exception
models
orm
tests
.gitignore
LICENSE
Makefile
Mormulous.php
README
TODO

README

Copyright (c) 2009, AF83, All rights reserved

You can ask for help and/or improvements or just say hi on the irc.freenode.org#morm 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
* STI
* FullText search with Sphinx (http://www.sphinxsearch.com/)

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
"name".

You can walk through its content by simply doing

<?php

require_once('Mormulous.php');

$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
conveniance.


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
fail.
If you want to avoid this behavior, just add

        
        protected $sti_field = NULL;


in the corresponding model



Feel free to ask for improvements
Something went wrong with that request. Please try again.