Table related configuration

The table configuration is obtained through the key "table" and is specific to each connection.

Property "class"

This property define the class associated with a type of record. If none is given, the class is "PorteRecord". It is used to create new record instances.

Property "type"

This property define a key to reference a given model. If none is given, the default behavior is to determine its name from the "class" property with a lowercase transformation.

This property is required if a model is not associated to a custom class but instead is a direct instance of "PorteRecord".

Property "table"

This property define the name of the table associated to a given record. For exemple, a class named "User" may have a table named "Users".

By default, if the "table" property is not defined, the table name is derived from the "type" property with a plural and camel case transformation.

Property "primary_key"

This property define the field name of the primary key. It default to the value "id".

If the primary key is not defined in the fields model, it is automatically added with a "type" equals to "int" and a "length" equals to "11".

Property "encoding"

This property is used on table creation and define the encoding of a given table. By default, the encoding is set to "utf8".

Property "engine"

This property is used on table creation and define the engine of a given table. By default, the engine is set to "MYISAM".

Open Source Object Relational Mapping in PHP

Download Porte 0.2.1