/**
  * @return User
  */
 public function getUser()
 {
     return $this->invite->getUser();
 }
Example #2
0
 /**
  * @param Invite $invite
  */
 public function sendInviteEmail(Invite $invite)
 {
     $template = 'TastdCoreBundle:Email:invite.html.twig';
     $html = $this->templating->render($template, array('invite' => $invite));
     $this->sendEmailMessage('[TASTD] Could you recommend me some good restaurants?', $html, $this->adminSender, $invite->getRecipients());
 }
 /**
  * @ApiDoc(
  *  description="Post a public invite on facebook wall",
  *  statusCodes={200="Success"},
  *  section="Invite",
  *  parameters={
  *      {"name"="message", "dataType"="string", "required"=true}
  *     }
  * )
  * @Route("/api/facebook-public-invite")
  * @Template{}
  * @Method({"POST"})
  * @return mixed
  * @throws CredentialNotFoundException
  */
 public function facebookPublicInviteAction()
 {
     $request = $this->requestStack->getCurrentRequest();
     $message = $request->request->get('message');
     $user = $this->getUser();
     $credential = $user->getCredentialByProvider(CredentialProvider::FACEBOOK);
     if (!$credential) {
         throw new CredentialNotFoundException();
     }
     $this->facebookClient->connect($credential->getToken());
     $invite = new Invite();
     $invite->setChannel(InviteChannel::FACEBOOK);
     $invite->setUser($user);
     $this->entityManager->persist($invite);
     $this->entityManager->flush();
     $this->facebookClient->publishLink('https://tastdapp.com/invite?invite=' . $invite->getCode(), $message);
     return $this->view(array('invite' => $invite), 201);
 }