/**
  * Linkedin authentication
  *
  * @ApiDoc(
  *     description = "Linkedin authentication",
  *     statusCodes = {
  *         200 = "Returned when successful",
  *         400 = "Returned when have any error"
  *     },
  *      output={
  *          "class" = "array<Hackathon\WorkBundle\Entity\User>",
  *          "groups" = {"user_detail"}
  *      },
  *      views = {"default"}
  * )
  *
  * @Get("/authentications/linkedin/{token}")
  *
  * @View(serializerGroups="user_detail")
  *
  * @param string $token
  * @return User
  */
 public function getAuthenticationLinkedinAction($token)
 {
     //Get user
     $linkedinUser = LinkedinUser::getUserByToken($token);
     $userManager = $this->getUserManager();
     $user = $userManager->findByLinkedin($linkedinUser);
     return $this->checkEmptyObject($user, 'hackathon.message._user_not_found');
 }
예제 #2
0
 /**
  * @param $token
  * @return Response
  */
 public function getInfoAction($token)
 {
     $linkedinUser = LinkedinUser::getUserByToken($token);
     $user = new User();
     $user->setEmail($linkedinUser->getEmail());
     $user->setName($linkedinUser->getFirstName() . ' ' . $linkedinUser->getLastName());
     $user->setLinkedinUser($linkedinUser);
     /** @var EntityManager $entityManager */
     $entityManager = $this->get('neo4j.manager');
     $entityManager->persist($linkedinUser);
     $entityManager->persist($user);
     $entityManager->flush();
     return new Response('');
 }