DB.PHP - PHP ORM

Define property field as primary field

Field is set as primary field by just specfying primary keyword to its specific property.

If you do not mark any property as primary in your class than field of property named as id will became primary. If no property with name id is found in class then first ever property field in class will became primary.

If field is primary but no property type data or field type data is provided: Then if field name is id field data type will became integer.

So this:

class something
{
    /**
    * primary
    */
    public $id;

....

Table field id will became primary auto_increment integer.

Has same effect as this (as far as id is first property in class definition):

class something
{
    public $id;

....

Table field id will became primary auto_increment integer.

But there:

class currency
{
    public $code;

....

Table field code will became primary char and class property code will became type string.

If you want that your class property field id was char:

class something
{
    /**
    * primary
    * @var string
    */
    public $id;

....