예제 #1
0
 /**
  * Calls rollback
  * @param \App\Model\Entities\User $uDb
  * @param \App\Model\Entities\User $formUser
  * @throws Exceptions\DuplicateEntryException
  * @throws Exceptions\DataErrorException
  */
 private function handleUpdateUser(User $uDb, User $formUser)
 {
     $identifier = null;
     $now = new DateTime();
     try {
         $this->editorTypeHandle($uDb->getWebProfile());
         $formUser->setWebProfile($uDb->getWebProfile());
         $formUser->setCreated($uDb->getCreated());
         $formUser->setUpdated($now);
         $formUser->setLastLogin($uDb->getLastLogin());
         $formUser->setContact($uDb->getContact());
         $uDb->fromArray($formUser->toArray());
         $this->entityManager->merge($uDb);
         $this->entityManager->flush();
     } catch (DuplicateEntryException $e) {
         $this->imageService->removeResource($identifier);
         throw new Exceptions\DuplicateEntryException($e->getMessage(), $e->getCode(), $e->getPrevious());
     } catch (\Exception $e) {
         $this->imageService->removeResource($identifier);
         throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
 }
예제 #2
0
 public function notifyNewPassword(User $u)
 {
     $subjKey = "systemModule.notification.newPassword.subject";
     $bodyKey = "systemModule.notification.newPassword.body";
     $subject = $this->translator->translate($subjKey, null, ["host" => $this->getHostName()]);
     $body = $this->translator->translate($bodyKey, null, ["name" => $u->getName(), "surname" => $u->getSurname(), "pass" => $u->provideRawPassword()]);
     $mail = new Message();
     $mail->setFrom($this->getSenderEmail())->setSubject($subject)->setBody($body)->addTo($u->getContact()->getEmail());
     $this->send($mail);
 }