About Us
Team
Values
Support
Open Source: dbentity
Overview
Download
Presentations and Articles
Examples: DBEntity Calling
Examples: DBEntity Classes
Examples: DBEntity Syntax
Examples: DB
Examples: DBQUERY
Examples: RBA
FAQ
Contact
ABOUT US
DBEntity - Syntax Examples

// dbentity functions often take arguments in multiple forms. Here's a quick explanation for this.

// All of the following create_ex calls are the same:
mg('products')->create_ex('name', 'widget a', 'category_id', 3)
mg('products')->create_ex('name', 'widget a', array('category_id' => 3));
mg('products')->create_ex(array('name' => 'widget a'), 'category_id', 3))
mg('products')->create_ex(array('name' => 'widget a', 'category_id' => 3))

// That's because the "create_ex" function is implemented:

function create_ex() {
    $args = rba::__(func_get_args());
    ...
}

// All of the following edit calls are the same:
mg('products')->edit($product_id, 'name', 'widget b', 'category_id', 3);
mg('products')->edit($product_id, array('name' => 'widget b'), 'category_id', 3);
mg('products')->edit($product_id, 'name', 'widget b', array('category_id' => 3));
mg('products')->edit($product_id, array('name' => 'widget b', 'category_id' => 3));

function edit($entity_id) {
    $args = rba::__slice(func_get_args(), 1);
    ...
}