mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding 'last' validator option fix for Model::invalidFields()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6240 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
44718cced7
commit
586e93f59f
1 changed files with 3 additions and 0 deletions
|
@ -1904,6 +1904,9 @@ class Model extends Overloadable {
|
|||
if (empty($validator['on']) || ($validator['on'] == 'create' && !$exists) || ($validator['on'] == 'update' && $exists)) {
|
||||
if ((!isset($data[$fieldName]) && $validator['required'] === true) || (isset($data[$fieldName]) && (empty($data[$fieldName]) && !is_numeric($data[$fieldName])) && $validator['allowEmpty'] === false)) {
|
||||
$this->invalidate($fieldName, $message);
|
||||
if ($validator['last']) {
|
||||
break;
|
||||
}
|
||||
} elseif (array_key_exists($fieldName, $data)) {
|
||||
if (empty($data[$fieldName]) && $data[$fieldName] != '0' && $validator['allowEmpty'] === true) {
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue