ORMer

From Wikipedia, the free encyclopedia

ORMer is a free, open-source (MIT License) object-relational mapping class written in PHP.

[edit] Features

The primary goal is to provide ORM functionality while keeping things easy on the developer. It makes no assumptions about table/field naming conventions and requires minimal configuration (no XML config files). Very soon it will provide automatic relation discovery through foreign keys.

The most exciting feature is the ability to reference relations (such as the orders associated with a particular customer) and specify additional stipulations for pulling the related data. See the second line of code in the example below.

[edit] Example

// Pull user objects "where email='me@host.com'"
$users = users::all()->where('email=?')->parameters('me@host.com');
 
// Chain through to pull ordered products starting with "a"
$products = $users->orders->order_products->products->where('product.name like "a%"');
 
// Loop over them and display their names
foreach($products as $product) {
    echo $product->name;
}

[edit] External links