Symfony 从 4.1 升级到 4.4 authenticationutils servicelocator
Symfony upgrade from 4.1 to 4.4 authenticationutils servicelocator
我正在尝试将 Symfony 应用程序从 4.1 升级到 4.4,但我在 SecurityController 中出现身份验证错误
public function loginAction (Request $request)
{
/* var AuthenticationUtils $authUtils */
$authUtils= $this->get('security.authentication_utils');
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
return $this->render('admin/user/login.html.twig', array(
'error' => $error,
'last_username' => $lastUsername,
));
}
但是升级后出现这个错误
我该如何解决这个错误?
..如@dbrunmann
所述
public function loginAction (Request $request, AuthenticationUtils $authUtils)
{
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
return $this->render('admin/user/login.html.twig', array(
'error' => $error,
'last_username' => $lastUsername,
));
}
使用 php bon\console debug:autowiring <some_service_name>
- 找出使用哪个 typhint 来获得正确的服务
例如php bin\console debug:autowiring utils
会给你
我正在尝试将 Symfony 应用程序从 4.1 升级到 4.4,但我在 SecurityController 中出现身份验证错误
public function loginAction (Request $request)
{
/* var AuthenticationUtils $authUtils */
$authUtils= $this->get('security.authentication_utils');
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
return $this->render('admin/user/login.html.twig', array(
'error' => $error,
'last_username' => $lastUsername,
));
}
但是升级后出现这个错误
我该如何解决这个错误?
..如@dbrunmann
所述public function loginAction (Request $request, AuthenticationUtils $authUtils)
{
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
return $this->render('admin/user/login.html.twig', array(
'error' => $error,
'last_username' => $lastUsername,
));
}
使用 php bon\console debug:autowiring <some_service_name>
- 找出使用哪个 typhint 来获得正确的服务
例如php bin\console debug:autowiring utils
会给你