Skip to content

Commit

Permalink
[Form] Adapted FormValidator to latest changes in the Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
webmozart committed Nov 24, 2012
1 parent 1f752e8 commit 1858b96
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,12 @@ public function validate($form, Constraint $constraint)

if ($form->isSynchronized()) {
// Validate the form data only if transformation succeeded
$path = $this->context->getPropertyPath();
$graphWalker = $this->context->getGraphWalker();
$groups = self::getValidationGroups($form);

if (!empty($path)) {
$path .= '.';
}

// Validate the data against its own constraints
if (self::allowDataWalking($form)) {
foreach ($groups as $group) {
$graphWalker->walkReference($form->getData(), $group, $path . 'data', true);
$this->context->validate($form->getData(), 'data', $group, true);
}
}

Expand All @@ -72,7 +66,7 @@ public function validate($form, Constraint $constraint)
foreach ($constraints as $constraint) {
foreach ($groups as $group) {
if (in_array($group, $constraint->groups)) {
$graphWalker->walkConstraint($constraint, $form->getData(), $group, $path . 'data');
$this->context->validateValue($form->getData(), $constraint, 'data', $group);

// Prevent duplicate validation
continue 2;
Expand Down
Loading

0 comments on commit 1858b96

Please sign in to comment.