Skip to content

Instantly share code, notes, and snippets.

@jverdeyen
Created December 5, 2014 14:28
Show Gist options
  • Save jverdeyen/9075b2b736bcac08ef86 to your computer and use it in GitHub Desktop.
Save jverdeyen/9075b2b736bcac08ef86 to your computer and use it in GitHub Desktop.
Symfony2 validate form without submit
$errors = $this->get('validator')->validate($user, array('user'));
foreach ($errors as $error) {
$form->get($error->getPropertyPath())->addError(new FormError($error->getMessage()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment