10.02.2013 Views

PHP Programming Language - OpenLibra

PHP Programming Language - OpenLibra

PHP Programming Language - OpenLibra

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ORMer 154<br />

ORMer<br />

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

Features<br />

The primary goal is to provide ORM functionality while keeping things easy on the developer. It makes no<br />

assumptions about table/field naming conventions and requires minimal configuration (no XML config files). For<br />

Sqlite2 and MySQL 5.1.x it provides automatic relation discovery through foreign keys.<br />

The most exciting feature is the ability to specify additional stipulations when referencing related data (such as the<br />

orders associated with a particular customer). See the second line of code in the example below.<br />

Example<br />

// Pull user objects "where email='me@host.com'"<br />

$users = users::find()->where('email=:email')->parameter('email',<br />

'me@host.com');<br />

// Chain through to pull ordered products starting with "a"<br />

// the database contains the following tables: users, orders,<br />

order_products, products<br />

// order_products associates products with an order<br />

$products = $users->orders->order_products->products->where('product.name<br />

like "a%"');<br />

// Loop over them and display their names<br />

foreach($products as $product) {<br />

}<br />

echo $product->name;<br />

External links<br />

• Project Home Page [1]<br />

• More Examples [2]<br />

References<br />

[1] http:/ / www. greaterscope. net/ projects/ ORMer<br />

[2] http:/ / www. greaterscope. net/ projects/ ORMer/ examples

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!