I want a model attribute to be changed before any validation or whatever by the model, not by the controller
let me explain my self better
class Domains extends Model{
public $domainExtension;//this will generate the .com or .net or something in the model
public function getDomainExtensions(){
return array(
'.com'=>'.com',
'.net'=>'.net',
//...
);
}
}
in the database there’s a field called ‘domain’ that is domain+domainExtension before validate, save or other functions
This is exactly as I would do. Changing data in beforeValidate is not fair, because in case of error the user will be propted with data different from what he typed, and that is bad.
You can do validation like that and change the value in the beforeSave.