public function sendInvitationMessage(User $user, User $userThatInvits, Project $project) { $subject = 'Invitation for new user to ' . self::SELF_NAME; $template = $this->templateName('invitationUser.html.twig'); $parameters = array('user' => $user, 'invites' => $userThatInvits, 'subject' => $subject, 'project' => $project, 'urls' => array('homePage' => $this->router->generate('home', array('invited' => $userThatInvits->getId(), 'project' => $project->getId()), true))); $emailTo = $user->getEmail(); return $this->sendMail($subject, $emailTo, $template, $parameters); }
/** * @Route("/user-upload-avatar", name="user_upload_avatar") */ public function userUploadAvatarAction(Request $request) { $session = $request->getSession(); $this->init(); $directory = dirname($this->get('kernel')->getRootDir()) . '/web/uploads'; $name = sprintf("avatar-%06d.png", $this->user->getId()); foreach ($request->files as $file) { $file->move($directory, $name); break; } $avatar = "/uploads/" . $name; ImageTools::resizeImage($directory . '/' . $name, 100, 100, array('action' => ImageTools::COPY_ORIG_DEST)); $this->user->setAvatarUrl($avatar); $this->em->persist($this->user); $this->em->flush($this->user); return $this->redirect($this->generateUrl('user_profile')); }