ORMer
Encyclopedia
ORMer is a free, open-source (MIT License
MIT License
The MIT License is a free software license originating at the Massachusetts Institute of Technology . It is a permissive license, meaning that it permits reuse within proprietary software provided all copies of the licensed software include a copy of the MIT License terms...

) object-relational mapping
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...

 class written in PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

.

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

The most exciting feature is the ability to specify 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

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK