Skip to content

Commit

Permalink
[Form] added missing DelegatingValidator registration in the Form Ext…
Browse files Browse the repository at this point in the history
…ension class (used when using the Form component outside a Symfony2 project where the validation.xml is used instead)
  • Loading branch information
fabpot committed Aug 22, 2011
1 parent 10ebdea commit eb67363
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Extension/Validator/ValidatorExtension.php
Expand Up @@ -14,6 +14,8 @@
use Symfony\Component\Form\Extension\Validator\Type;
use Symfony\Component\Form\AbstractExtension;
use Symfony\Component\Validator\ValidatorInterface;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\Valid;

class ValidatorExtension extends AbstractExtension
{
Expand All @@ -22,6 +24,10 @@ class ValidatorExtension extends AbstractExtension
public function __construct(ValidatorInterface $validator)
{
$this->validator = $validator;

$metadata = $this->validator->getMetadataFactory()->getClassMetadata('Symfony\Component\Form\Form');
$metadata->addConstraint(new Callback(array(array('Symfony\Component\Form\Extension\Validator\Validator\DelegatingValidator', 'validateFormData'))));
$metadata->addPropertyConstraint('children', new Valid());
}

public function loadTypeGuesser()
Expand Down

0 comments on commit eb67363

Please sign in to comment.