DB.PHP - PHP ORM

Map namespace classes to tables

If we have many classes in namespace we can add them using just one line of code:

namespace shop;

class product
{
    ....
}
class cart
{
    ....
}
class cost
{
    ....
}
$database->scan ('\namespace');

Or

$database->scan ('\\namespace');

Or

$database->scan ('.namespace');

In this case if we scan:

$database->scan ('.shop');

We will have following class table handlers:

$database->shop->product
$database->shop->cart
$database->shop->cost

Class table handler is an instance of \db\table it contains information for mapping class to actual database table and api for accessing class table data. For further exploration of class table handlers see sample at https://github.com/hazardland/db.php/blob/master/samples/003.class.php