MERGE: Bringing the ValidationGroup feature back to work.

- ugly: they get extracted from options, as I do not see any other
  possibility
This commit is contained in:
Ferdinand Kuhl 2017-06-29 21:34:20 +02:00
parent f0e31dcc11
commit eccc2b1bdd

View file

@ -133,6 +133,7 @@ class SettingsValidator extends AbstractValidator
if (is_null($validation)) { if (is_null($validation)) {
continue; continue;
} }
$this->extractValidationGroupsFromOptions($newValidation);
$newValidation['options'] = $validation; $newValidation['options'] = $validation;
$newValidation['validator'] = $validator; $newValidation['validator'] = $validator;
$config[] = $newValidation; $config[] = $newValidation;
@ -144,6 +145,7 @@ class SettingsValidator extends AbstractValidator
if (is_null($options)) { if (is_null($options)) {
continue; continue;
} }
$this->extractValidationGroupsFromOptions($options);
$newValidation['property'] = $propertyName; $newValidation['property'] = $propertyName;
$newValidation['validator'] = $validator; $newValidation['validator'] = $validator;
$newValidation['options'] = $options; $newValidation['options'] = $options;
@ -182,4 +184,15 @@ class SettingsValidator extends AbstractValidator
$validatorConfig['options']['validationGroups'] = $this->options['validationGroups']; $validatorConfig['options']['validationGroups'] = $this->options['validationGroups'];
} }
} }
/**
* @param $newValidation
*/
protected function extractValidationGroupsFromOptions(&$newValidation)
{
if (isset($newValidation['options']['validationGroups'])) {
$newValidation['validationGroups'] = $newValidation['options']['validationGroups'];
unset($newValidation['options']['validationGroups']);
}
}
} }