예제 #1
0
 public static function make(User $user, $action, $ip = '0.0.0.0')
 {
     $audit = new AuditLog();
     $audit->setUser($user);
     $audit->setAction($action);
     $audit->setIpAddress($ip);
     return $audit;
 }
 /**
  * This method is called by the LogoutListener when a user has requested
  * to be logged out. Usually, you would unset session variables, or remove
  * cookies, etc.
  *
  * @param Request $request
  * @param Response $response
  * @param TokenInterface $token
  */
 public function logout(Request $request, Response $response, TokenInterface $token)
 {
     if ($token !== null && ($user = $token->getUser())) {
         $audit = AuditLog::make($user, 'logout', $request->getClientIp());
         $this->em->persist($audit);
         $this->em->flush();
     }
 }