fix validation on person update

close #408
This commit is contained in:
2015-01-29 22:01:16 +01:00
parent 0a1ff9e141
commit d554407dce
3 changed files with 8 additions and 11 deletions

View File

@@ -91,16 +91,11 @@ class PersonController extends Controller
if ($request->getMethod() === 'POST') {
$form->handleRequest($request);
$errors = $this->get('validator')
->validate($person, array('general'));
if ( count($errors) > 0 ) {
$errors = $form->getErrorsAsString();
if ( ! $form->isValid() ) {
$this->get('session')
->getFlashBag()->add('danger', 'error' . $errors);
->getFlashBag()->add('danger', 'Thp person data provided'
. ' are not valid');
return $this->render('ChillPersonBundle:Person:edit.html.twig',
array('person' => $person,
@@ -110,7 +105,7 @@ class PersonController extends Controller
$this->get('session')->getFlashBag()
->add('success',
$this->get('translator')
->trans('The person has been created')
->trans('The person data has been updated')
);
$em = $this->getDoctrine()->getManager();