public function process() { if ('POST' == $this->request->getMethod()) { if ($this->form->isValid()) { $user = $this->form->getData(); $this->user = $user; $user->setUsername($user->getEmail()); $user->setJoindate(new \DateTime()); $this->plainpass = $user->getPassword(); $user->setPassword($this->encoder->encodePassword($user->getPassword(), $user->getSalt())); $user->setEnabled(true); if ($user->getNationaliteVoulu() == null || $user->getNationaliteVoulu() == "") { $user->setNationalityOsef(true); } else { $user->setNationalityOsef(false); } try { $this->em->persist($user); $this->section->addUser($user); $this->em->flush(); } catch (\Exception $e) { $this->request->getSession()->getFlashBag()->set('error', 'error.mentor.username'); return false; } $this->onSuccess(); return true; } $this->request->getSession()->getFlashBag()->set('error', 'error.mentor.invalidform'); } return false; }