Esempio n. 1
0
 public function updateUser(User $user)
 {
     $app = $this->app;
     $em = $this->em;
     $repo = $em->getRepository('Digitools\\eslTools\\Entities\\User');
     $password = $app->request->post('wachtwoord');
     if (isset($password) && trim($password) != '') {
         $hash = password_hash($password, CRYPT_BLOWFISH);
         $user->setPassword($hash);
     }
     $first_name = $app->request->post('voornaam');
     if ($user->getFirstName() != $first_name) {
         $user->setFirstName($first_name);
     }
     $surname = $app->request->post('naam');
     if ($user->getSurname() != $surname) {
         $user->setSurname($surname);
     }
     $postcode_id = $app->request->post('postcode');
     if ($user->getPostcode()->getId() != $postcode_id) {
         $reg_srv = new RegistrationService($em, $app);
         $postcode = $reg_srv->getPostcodeObject($postcode_id);
         $user->setPostcode($postcode);
     }
     $address = $app->request->post('adres');
     if ($user->getAddress() != $address) {
         $user->setAddress($address);
     }
     $em->persist($user);
     $em->flush();
 }
Esempio n. 2
0
 public function profile_edit_store()
 {
     $app = $this->getApp();
     if ($this->srv->dataIsValid()) {
         $this->srv->updateUser($this->getUser());
         $app->flash('info', 'De wijzigingen in uw profiel zijn bewaard.');
         $app->redirect($app->urlFor('profile_show'));
     } else {
         $reg_srv = new RegistrationService($this->getEntityManager(), $this->getApp());
         $pc = $reg_srv->getPostcodes();
         $app->render('Profile\\profile_edit.html.twig', array('globals' => $this->getGlobals(), 'errors' => $this->srv->getErrors(), 'postcodes' => $pc));
     }
 }