I upgraded DMZ from 1.6.2 to 1.7.1.
Just wanted to inform that if someone else has done the same.
Before DMZ 1.7.x there was no built-in way to localize labels so I did it this way:
class Customer Extends DataMapper {
var $validation;
var $has_one = array('customer','country');
function __construct()
{
parent::__construct();
$this->_set_validation();
}
function _set_validation()
{
$this->validation = array(
'name' => array(
'label' => lang('account.name'),
'rules' => array('required','trim','min_lenght' => 3,'max_lenght' => 255)
)
...
'confirm_password' => array(
'label' => lang('account.confirm_password'),
'rules' => array('required', 'encrypt', 'matches' => 'password', 'min_length' => 3, 'max_length' => 40),
'type' => 'password'
)
);
}
}
This way of doing it messes up the validation in the new version so be sure to update your models to the new localization system(which is great btw!).
The problem with my previous approach was that if updating existing customer, the validation would fail because not defining confirm_password. For example:
$customer = new Customer();
$customer->get_by_name('cahva');
$customer->name = 'Cahvaaaa';
$customer->save();
That failed with 1.7.1 but not the earlier 1.6.2 version..
So if you are upgrading from earlier version and done something similar to get validation localized before, be sure to update your models.
EDIT: Hmm.. Could it be that using parent::__construct() before the _set_validation could have caused this behaviour?? Maybe that parent::__construct() was not needed anyway.. I have probably left it there by accident.