@@ -143,7 +143,9 @@ |
||
| 143 | 143 | $validationErrors = []; |
| 144 | 144 | foreach ($this->fields() as $fieldName => $field) { |
| 145 | 145 | $value = array_key_exists($fieldName, $row) ? $row[$fieldName] : null; |
| 146 | - if (in_array($value, $this->missingValues())) $value = null; |
|
| 146 | + if (in_array($value, $this->missingValues())) { |
|
| 147 | + $value = null; |
|
| 148 | + } |
|
| 147 | 149 | try { |
| 148 | 150 | $outRow[$fieldName] = $field->castValue($value); |
| 149 | 151 | } catch (Exceptions\FieldValidationException $e) { |
@@ -118,7 +118,9 @@ |
||
| 118 | 118 | final public function castValue($val) |
| 119 | 119 | { |
| 120 | 120 | if ($this->isEmptyValue($val)) { |
| 121 | - if ($this->required()) throw $this->getValidationException("field is required", $val); |
|
| 121 | + if ($this->required()) { |
|
| 122 | + throw $this->getValidationException("field is required", $val); |
|
| 123 | + } |
|
| 122 | 124 | return null; |
| 123 | 125 | } else { |
| 124 | 126 | return $this->validateCastValue($val); |