public function loadUserByOAuthUserResponse(UserResponseInterface $response)
 {
     try {
         return parent::loadUserByOAuthUserResponse($response);
     } catch (UsernameNotFoundException $e) {
         // User not found, let's register them.
         $user = new User();
         $user->setEmail($response->getEmail());
         $user->setFacebookId($response->getUsername());
         $this->em->persist($user);
         $this->em->flush();
         return $user;
     }
 }
Example #2
0
 public function __construct(ManagerRegistry $registry, $class, array $properties, $managerName = null, $encoderFactory, $session)
 {
     parent::__construct($registry, $class, $properties, $managerName);
     $this->encoderFactory = $encoderFactory;
     $this->session = $session;
 }
 public function __construct(ManagerRegistry $registry, $class, array $properties, $managerName = null)
 {
     parent::__construct($registry, $class, $properties, $managerName);
     $this->em = $registry->getManager($managerName);
 }