/** * Form OK * @param Form $form */ public function formSucceeded(Form $form) { $values = $form->getValues(TRUE); if (!$values['photo']->isImage() && $values['photo']->isOK()) { $form->addError('Toto není obrázek'); } else { $date = $this->parseDateDatabase($values['year'], $values['month'], $values['day']); if ($date === false) { $form->addError('Takové datum neexistuje'); } else { $values['born'] = $date; try { if (isset($values['privileges'])) { $privileges = $this->parsePrivileges($values['privileges']); unset($values['privileges']); $values['permissions'] = $privileges; } $this->userManager->updateUser($values, isset($values['id']) ? $values['id'] : $this->user); } catch (\Exception $e) { $form->addError($e->getMessage()); } } } }