Skip to content

Instantly share code, notes, and snippets.

@teo-sk
Created May 10, 2012 07:25
Show Gist options
  • Save teo-sk/2651662 to your computer and use it in GitHub Desktop.
Save teo-sk/2651662 to your computer and use it in GitHub Desktop.
Symfony get errors formatted in array
<?php
private function getErrorMessages(\Symfony\Component\Form\Form $form) {
$errors = array();
foreach ($form->getErrors() as $key => $error) {
$errors[] = strtr($error->getMessageTemplate(), $error->getMessageParameters());
}
return $errors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment