Ejemplo n.º 1
0
 public function login($firstName, $lastName, $dateOfBirth, $email, $gender, $fbId, $location = array(), $version, $container, $em)
 {
     $result = VTExceptionService::STATUS_INTERNAL_ERROR;
     // by default
     $user = $em->getRepository('ApiBundle:User')->findOneBy(array("fbId" => $fbId));
     if (empty($user)) {
         $user = new User();
         $user->setFirstName($firstName);
         $user->setLastName($lastName);
         $user->setEmail($email);
         $user->setGender($gender);
         $user->setBirthday(new \DateTime($dateOfBirth));
         $user->setFbId($fbId);
         $em->persist($user);
         $em->flush();
         return VTExceptionService::STATUS_OBJECT_CREATED;
     } else {
         return VTExceptionService::STATUS_OK;
     }
     return $result;
 }
Ejemplo n.º 2
0
 public function getUserDataAction(User $user)
 {
     $data = [];
     $name = $user->getFirstName();
     $lastname = $user->getLastName();
     $email = $user->getEmail();
     $phone = $user->getPhone();
     $password = "";
     $passwordConfirmation = "";
     $data = array("userId" => $user->getId(), "name" => $name, "lastname" => $lastname, "email" => $email, "phone" => $phone, "password" => $password, "passwordConfirmation" => $passwordConfirmation);
     return $data;
 }