DataMapper ORM


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
all_array_uses_ids Boolean If TRUE, uses the old DataMapper behavior for indexing the all array. FALSE 1.5.2
db_params Mixed If '' (empty string), Datamapper ORM models will connect using the default DataBase config.
If FALSE, all models will connect to $CI->db. (Note: this breaks subqueries, and any feature that relies on subqueries.)
If anything else, the value is passed into $CI->load->database(). See the CodeIgniter manual for more information.
'' 1.6.0
timestamp_format String Overrides the default date-compatible timestamp format. Y-m-d H:i:s O 1.7.0
lang_file_format String When set, this pattern is used to tell Datamapper ORM which language file to load for each model.
For new installations, this actually defaults to 'model_${model}'.
'' 1.7.0
field_label_lang_format String Tells Datamapper ORM which language pattern to use when loading labels for fields. ${model}_${field} 1.7.0
cascade_delete Boolean If set to FALSE, relations will NOT be deleted by datamapper when deleting an object. Your RDBMS should take care of cascading deletes. TRUE 1.8.1

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.