protected function getErrorForRequest(Request $request)
    {
        $authenticationErrorKey = Security::AUTHENTICATION_ERROR;

        if ($request->attributes->has($authenticationErrorKey)) {
            return $request->attributes->get($authenticationErrorKey);
        }

        $session = $request->getSession();
        if (null !== $session && $session->has($authenticationErrorKey)) {
            $error = $session->get($authenticationErrorKey);
            $session->remove($authenticationErrorKey);

            return $error;
        }

        return '';
    }
protected function getErrorForRequest(Request $request)
    {
        $authenticationErrorKey = Security::AUTHENTICATION_ERROR;

        if ($request->attributes->has($authenticationErrorKey)) {
            return $request->attributes->get($authenticationErrorKey);
        }

        $session = $request->getSession();
        if (null !== $session && $session->has($authenticationErrorKey)) {
            $error = $session->get($authenticationErrorKey);
            $session->remove($authenticationErrorKey);

            return $error;
        }

        return '';
    }
protected function getErrorForRequest ( Request $ request ) { $ authenticationErrorKey = Security :: AUTHENTICATION_ERROR ; if ( $ request -> attributes -> has ( $ authenticationErrorKey ) ) { return $ request -> attributes -> get ( $ authenticationErrorKey ) ; } $ session = $ request -> getSession ( ) ; if ( null !== $ session && $ session -> has ( $ authenticationErrorKey ) ) { $ error = $ session -> get ( $ authenticationErrorKey ) ; $ session -> remove ( $ authenticationErrorKey ) ; return $ error ; } return '' ; }
Get the security error for a given request.

@param Request $request

@return string|\Exception
Get the security error for a given request .