DB.PHP - PHP ORM

Load by id from table

To load single object by id for class from table use following:

$database->path->to->class->load (mixed $id);

Example:

$product = $database->shop->product->load (2);
echo $product->name;

In case if primary field is string like $currency->code:

$currency = $database->cashier->currency->load ('USD');
echo $currency->name;