Software:ORMer

From HandWiki

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

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 configuration files). For Sqlite2 and MySQL 5.1.x it provides automatic relation discovery through foreign keys.

The class allows additional stipulations when referencing related data (such as the orders associated with a particular customer). See the second line of code in the example below.

Example

// Pull user objects "where email='me@host.com'"
$users = users::find()->where('email=:email')->parameter('email', 'me@host.com');
 
// Chain through to pull ordered products starting with "a"
// the database contains the following tables: users, orders, order_products, products
// order_products associates products with an order
$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;
}

External links