DB.PHP - PHP ORM

Map property to custom field name

In case you have table field named by some other developer who does not care how your code looks like and he named product title field in products table like productTitle but you have product class and property named title in it. In regular world you have two options: 1. rename your class property to productTitle and you will have $product->productTitle 2. or rename table field to title and you will have $product->title. But in db.php you can leave field title as is and link your property to that field. This is done by field keyword.

class product
{
...
    /**
    * field productTitle
    */
    public $title;
...
}

And after this $product->title will be mapped to productTitle field. Have fun and note that simillary you can map class to custom table name but it is subject of further reading.