|
@@ 49-52 (lines=4) @@
|
| 46 |
|
if (array_key_exists('required', $fieldRules)) { |
| 47 |
|
unset($fieldRules['required']); |
| 48 |
|
|
| 49 |
|
if (!array_key_exists($fieldName, $data)) { |
| 50 |
|
$this->addError(new ValidationException('Field \'' . $fieldName . '\' of ' . $this->getContextName() . ' is required')); |
| 51 |
|
|
| 52 |
|
continue; |
| 53 |
|
} |
| 54 |
|
} elseif (!array_key_exists($fieldName, $data)) { |
| 55 |
|
continue; |
|
@@ 61-64 (lines=4) @@
|
| 58 |
|
|
| 59 |
|
/** Validation of all other rules*/ |
| 60 |
|
foreach ($fieldRules as $ruleName => $ruleInfo) { |
| 61 |
|
if (!array_key_exists($ruleName, $this->validationRules)) { |
| 62 |
|
$this->addError(new ValidationException('Field \'' . $fieldName . '\' has invalid rule \'' . $ruleInfo . '\'')); |
| 63 |
|
|
| 64 |
|
continue; |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
if (!$this->validationRules[$ruleName]->validate($data[$fieldName], $ruleInfo)) { |