Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions classes/Kohana/Jam/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,7 @@ public function execute_validators(Jam_Validated $model)
$validator->validate_model($model);
}

if (method_exists($model, 'validate'))
{
$model->validate();
}
$model->validate();

return $this;
}
Expand Down
12 changes: 12 additions & 0 deletions classes/Kohana/Jam/Validated.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,18 @@ public function check_insist()
return $this;
}

/**
* Override this function to add custom validation after the validators.
* Having an empty validate function allow safely calling parent::validate()
* when extending models.
*
* You need to set errors with:
* $this->errors()->add('field', 'error_name');
*
* @link http://git.io/5I47Tw docs
*/
public function validate() {}

/**
* Get the errors from the previous check, if you provide a name, will return the errors only for that name
* Automatically loads the error messages file from messages/jam-validation/<model_name>
Expand Down