Used in...

The following countries:

GROMM is a Relational-Object Mapper for the Masses

I developed GROMM because I was in need of a good ORM for PHP with some special features, like class inheritance support. I searched for it and after a while I decided to develop one for my own and the community.

GROMM is a work-in-progress and the code is currently being tested.

The pre-release "alpha" version is not suitable for usage but you can look at the source code.

 

Example

Scenario:

Code:


$bob = Dog.orm_fetch(55);   // fetch for Dog table record with id = 55
$ike = Cat.orm_create();    // this Cat ID will be assigned at save time
$bob->enemy = $ike;         // ike's "enemy" (1:1 relationship) is automatically set to bob

$killers = array( $bob, $ike );   // $killers is array of (abstract) Carnivore

$mice = Mice.orm_fetch( array(23, 32, 64) );   // fetch multiple rows at a time
list ( $paco, $luis, $hugo ) = $mice;          // each mouse has a different personality

foreach ( $killers as $ogre ) { $ogre->can_eat = $mice }  // create the N:M (and M:N) pairs

$bob->eaten_by( $hugo );   // a mouse is dead; $paco and $luis are angry and want to kill $bob
$hugo.delete();            // delete from DB and update automatically all its relationships
$mice.array_pop();         // delete $hugo from the array of mice

// alive mice can't kill $bob by themselves; they decide to pact with the cat; $ike agrees
$ike->allied = array( $paco, $luis );   // set the 1:N alliance (Mice.allied is also updated)

$cartel = array( $paco, $luis, $ike );  // a secret forge of animals
foreach ( $cartel as $agent ) { $agent->will_kill( $bob ); }   // set the 1:N relationship

$bob->fight();   // as result of executing of this behaviuor, $bob dies... RIP
$bob.delete();   // should be done inside Dog::fight(); $bob's relationships are deleted

unset( $ike->allied );                        // destroy the alliance
$paco->save(); $luis->save(); $ike->save();   // the other way is using auto-save

foreach ( $mice as $mouse ) { $mouse->run_to_the_hills(); }   // remember $ike? life resumes...
            

 

Features

 

History

 

Contributors

In order of appearance:

 

License

This work is licensed under the GNU General Public License (GPL).

 

Author

Gorka G LLona (profile).

 

Feedback

Please contact the author for improvements, suggestions and bugs.

Template Design by Derby Web Design

Syntax highlighter by WebCodingStudio.com