I have the following, for example:
class Model_User extends ORM {
protected $_rules = array(
'username' => array(
'not_empty' => NULL,
'min_length' => array(6),
'max_length' => array(250),
'regex' => array('/^[-\pL\pN_@.]++$/uD'),
),
'password' => array(
'not_empty' => NULL,
'min_length' => array(5),
'max_length' => array(30),
),
'password_confirm' => array(
'matches' => array('password'),
),
);
}
class Model_UserAdmin extends Model_User {
protected $_rules = array(
'username' => array(
'not_empty' => NULL,
'min_length' => array(6),
'max_length' => array(250),
'regex' => array('/^[-\pL\pN_@.]++$/uD'),
),
'password' => array(
'not_empty' => NULL,
'min_length' => array(5),
'max_length' => array(42),
),
);
}
In here, Model_UserAdmin
extends Model_User
and overrides the max length for password and removes the validation for password_confirm
(this is not an actual case, but an example).
Is there a better way instead of redefining the entire $_rules
property/array?