Map class to table

Here begins most interesting part of db.php as we have setted up desired connection(s) now we need to make database know about our class(es).

To add single "class to table" handler or so called "class handler" you have to:

$database->add (string $class);



Also you can specify class path by dots:


First dot in string makes no sense but you also can:


For example if we have:

namespace shop;

class product

We can:

$database->add ('shop.product');

We added class handler to orm now we need to access class handler.

After adding class to database we can access class table handler by


In \shop\product example class case we will access it like this:


Note: The only reserved namespace name is 'context' it means you must not have classes in namespace named 'context' or class without namespace named 'context'. $database->context is used by database object for storing various data such is conenction links, table handlers, defined locales, varius cache handlers and so on.