Upgrading Instructions
Upgrading requires replacing a few files, and sometimes updating your configuration. You can upgrade from a previous version of DMZ or the original DataMapper.
Upgrading from a previous version of DMZ
All versions
- Overwrite application/libraries/datamapper.php.
- Copy any new extensions in application/datamapper that you would like to use.
Some extensions may require additional views, libraries, helpers, or other items to function correctly. Please check the extensions you plan on using.
- If you are using the Production Cache, please clear it, or even disable it until you have tested the new version.
Then look below for additional, specific changes for each version.
You can determine which version of DMZ you are using by looking at the top of application/libraries/datamapper.php
From 1.4.1 to 1.4.2
- If you looped over a DMZ model using foreach (to read the properties), it will no longer work. This is due to a change that allows looping over the model directly to loop over the all.
From 1.4.0 to 1.4.1
- Simply overwrite datamapper.php.
From 1.3.2 to 1.4.0
- Overwrite application/language/english/datamapper.php to enable some new error messages.
- If you have any custom related validation rules, the arguments have changed very slightly.
Previously, the first argument would have been whatever was passed in to save.
Now, if the $object was saved with a specific
related_field, the $object will be wrapped in a single-item array, with therelated fieldas its key. - The _count_related method, which is used on related required, min_size, and max_size methods, now is more accurate, and may show errors where it previously was reporting a false positive.
- Overwrite the
jsonextension in application/datamapper/json.php if you use it. These new reserved names have been added, and should not be overwritten:
Functions load_extension save_as_new skip_validation ilike or_ilike not_ilike or_not_ilike group_start or_group_start not_group_start or_not_group_start group_end _get_prepend_type _count_related_objects _handle_default_order_by _save_itfk _save_related_recursive Variables $_force_save_as_new $_where_group_started $free_result_threshold $default_order_by
- As this is a significant update, you may want to look at the Change Log, to see how the new features can benefit you.
From 1.3.1 to 1.3.2
The fixes to the relationship joins may break any hard-coded SQL, where you specify the table name. Now, for any relationship that uses a
related fieldthat is different than the class, therelated fieldis appended to the table name, to allow that relationship to be queried specifically.For example, if you are querying creator, which is a user, the joined table is named creator_users.
This is only an issue if you have included custom SQL (such as in where statements), and included the table name, and are querying a relationship that has a different relationship name than the model name.
From 1.3.0 to 1.3.1
- If you use it, replace application/helpers/inflector_helper.php.
From 1.2.5 or older to 1.3.0
- Replace all occurances of join_related with include_related, as join_related has been deprecated, and will be removed in a future update.
- Update your application/config/datamapper.php file, as there are a few new items.
- Optionally, upload the application/datamapper directory to your CodeIgniter application folder, to enable the use of extensions.
Upgrading from the original DataMapper
If you are upgrading from the original DataMapper, these are the steps you should take.
- Update your application/config/datamapper.php file, as there are a few new items.
- Overwrite application/libraries/datamapper.php.
- Overwrite application/language/english/datamapper.php.
- Optionally, upload the application/datamapper directory to your CodeIgniter application folder, to enable the use of extensions.
- Look over the upgrade information above, to see if you are using any hacks or tricks that may be broken by DMZ's new features.
- After reading through this manual, you may want to adopt many of the new features throughout your code!