Configuration
DataMapper has some configuration settings which you can customise to suit your needs. They will apply to all DataMapper models unless overridden in the models themselves. These are:
Name | Type | Description | Default | Since Ver. |
---|---|---|---|---|
prefix | String | If set, will require all tables (both normal and joining tables) to have this prefix. | DataMapper | |
join_prefix | String | If set, will require all joining tables to have this prefix (overrides prefix). | DataMapper | |
error_prefix | String | If set, will be prepended onto each error message. | <p> | DataMapper |
error_suffix | String | If set, will be appended onto each error message. | </p> | DataMapper |
created_field | String | The field name for storing the created timestamp. | created | DataMapper |
updated_field | String | The field name for storing the updated timestamp. | updated | DataMapper |
local_time | Boolean | If set to TRUE, will use local timestamps. Otherwise, GMT/UTC is used. | FALSE | DataMapper |
unix_timestamp | Boolean | If set to TRUE, will use 'Unix Timestamp' instead of 'DateTime'. | FALSE | DataMapper |
auto_transaction | Boolean | If set to TRUE, will automatically handle transactions. | FALSE | DataMapper |
auto_populate_has_many | Boolean | If set to TRUE, will automatically populate related "has many" objects on first access. | FALSE | DataMapper |
auto_populate_has_one | Boolean | If set to TRUE, will automatically populate related "has one" objects on first access. | FALSE | DataMapper |
production_cache | Mixed | If set to a string, will cause DataMapper to cache the database schema to the directory listed. | FALSE | 1.3.0 |
extensions | Array | An array of extensions to load globally on every class. | (empty) | 1.3.0 |
extensions_path | String | The default path to extensions, relative to application | datamapper | 1.3.0 |
To modify your settings, open the application/config/datamapper.php file with a text editor and set your preferred configuration settings.
Note: You can override these settings by specifying values directly in your models, except for production_cache and extensions_path.