コード例 #1
0
 public function checkAuthentication(UserInterface $user, UsernamePasswordToken $token)
 {
     $connector = new Connector($user->getUsername(), $token->getCredentials());
     if (!$connector->isSignedIn()) {
         throw new BadCredentialsException();
     }
     $student = $connector->getStudent();
     $user->fromStudent($student);
     $user->setLastConnectionAt(new \DateTime());
     if ($user->getId() == null || $user->getAccount() == null) {
         $user->setAccount(new Account());
     }
     $this->em->persist($user);
     $this->em->flush();
 }