src/Templates/Validator/PropertyNames.phptpl
(function ($propertyNames) use (&$invalidProperties) {
{% if generatorConfiguration.collectErrors() %}
$originalErrorRegistry = $this->_errorRegistry;
{% endif %}
foreach ($propertyNames as $value) {
// numerical array indices are auto casted to int
$value = (string) $value;
try {
{% if generatorConfiguration.collectErrors() %}
$this->_errorRegistry = new {{ viewHelper.getSimpleClassName(generatorConfiguration.getErrorRegistryClass()) }}();
{% endif %}
{% foreach nameValidationProperty.getOrderedValidators() as validator %}
{{ viewHelper.renderValidator(validator, schema) }}
{% endforeach %}
{% if generatorConfiguration.collectErrors() %}
if ($this->_errorRegistry->getErrors()) {
$invalidProperties[$value] = $this->_errorRegistry->getErrors();
}
{% endif %}
} catch (\Exception $e) {
// collect all errors concerning invalid property names
isset($invalidProperties[$value])
? $invalidProperties[$value][] = $e
: $invalidProperties[$value] = [$e];
}
}
{% if generatorConfiguration.collectErrors() %}
$this->_errorRegistry = $originalErrorRegistry;
{% endif %}
return !empty($invalidProperties);
})(array_keys($modelData))