Skip to content

Commit

Permalink
Merge pull request Sylius#3731 from pjedrzejewski/remove-configuratio…
Browse files Browse the repository at this point in the history
…n-form-validation-groups

Remove configuration form validation groups
  • Loading branch information
michalmarcinkowski committed Dec 18, 2015
2 parents 61ead6d + 4c418b6 commit ed65878
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions DependencyInjection/Driver/AbstractDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function setClassesParameters(ContainerBuilder $container, MetadataInt

foreach ($validationGroups as $formName => $groups) {
$suffix = 'default' === $formName ? '' : sprintf('_%s', $formName);
$container->setParameter(sprintf('%s.validation_groups.%s%s', $metadata->getApplicationName(), $metadata->getName(), $suffix), $groups);
$container->setParameter(sprintf('%s.validation_groups.%s%s', $metadata->getApplicationName(), $metadata->getName(), $suffix), array_merge(array('Default'), $groups));
}
}

Expand Down Expand Up @@ -154,16 +154,15 @@ protected function addForms(ContainerBuilder $container, MetadataInterface $meta

default:
$validationGroupsParameterName = sprintf('%s.validation_groups.%s%s', $metadata->getApplicationName(), $metadata->getName(), $suffix);
$validationGroups = new Parameter($validationGroupsParameterName);

if ($container->hasParameter($validationGroupsParameterName)) {
$validationGroups = new Parameter($validationGroupsParameterName);
} else {
if (!$container->hasParameter($validationGroupsParameterName)) {
$validationGroups = array('Default');
}

$definition->setArguments(array(
$metadata->getClass('model'),
$validationGroups,
$validationGroups
));
break;
}
Expand Down

0 comments on commit ed65878

Please sign in to comment.