File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 18
18
"ext-json" : " *"
19
19
},
20
20
"require-dev" : {
21
- "phpunit/phpunit" : " ^8.0 "
21
+ "phpunit/phpunit" : " ^8.4 "
22
22
},
23
23
"autoload" : {
24
24
"psr-4" : {
Original file line number Diff line number Diff line change @@ -122,12 +122,7 @@ class {{ class }}
122
122
$this->errorRegistry = new {{ viewHelper.getSimpleClassName(generatorConfiguration.getErrorRegistryClass()) }}();
123
123
{% endif%}
124
124
125
- {% foreach property.getOrderedValidators() as validator %}
126
- {{ validator.getValidatorSetUp() }}
127
- if ({{ validator.getCheck() }}) {
128
- {{ viewHelper.validationError(validator.getExceptionMessage()) }}
129
- }
130
- {% endforeach %}
125
+ $value = $this->validate{{ viewHelper.ucfirst(property.getAttribute()) }}($value, $modelData);
131
126
132
127
{% if generatorConfiguration.collectErrors() %}
133
128
if ($this->errorRegistry->getErrors()) {
@@ -154,14 +149,22 @@ class {{ class }}
154
149
155
150
{{ viewHelper.resolvePropertyDecorator(property) }}
156
151
152
+ $this->{{ property.getAttribute() }} = $this->validate{{ viewHelper.ucfirst(property.getAttribute()) }}($value, $modelData);
153
+ }
154
+
155
+ /**
156
+ * Execute all validators for the property {{ property.getAttribute() }}
157
+ */
158
+ protected function validate{{ viewHelper.ucfirst(property.getAttribute()) }}($value, array $modelData)
159
+ {
157
160
{% foreach property.getOrderedValidators() as validator %}
158
161
{{ validator.getValidatorSetUp() }}
159
162
if ({{ validator.getCheck() }}) {
160
163
{{ viewHelper.validationError(validator.getExceptionMessage()) }}
161
164
}
162
165
{% endforeach %}
163
166
164
- $this->{{ property.getAttribute() }} = $value;
167
+ return $value;
165
168
}
166
169
{% endforeach %}
167
170
}
You can’t perform that action at this time.
0 commit comments