據Symfony的3.0版本The Symfony\Component\Security\Core\SecurityContext
begining將被刪除。這已經在這裏討論:Symfony 2 SecurityContext class deprecated安全註釋和Symfony的分量安全核心 SecurityContext中,此類已廢棄
我的symfony報告以下錯誤:
Error: The Symfony\Component\Security\Core\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage or Symfony\Component\Security\Core\Authorization\AuthorizationChecker instead.
我使用annotations
symfony的管理我的安全角色如
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; // Security annotation bundle
/**
* @Route("/account/list", name="Account_list")
* @Security("has_role('ROLE_USER')")
*/
我應該如何切換到非折舊類?
無論是使用在錯誤結果中列出的類:
[Semantical Error] The annotation "@Security" in method AppBundle\Controller\AccountController::listAction() was never imported. Did you maybe forget to add a "use" statement for this annotation? in /var/www/gra.investmentopportunities.pl/src/AppBundle/Controller/ (which is being imported from "/var/www/gra.investmentopportunities.pl/app/config/routing.yml").
您仍然應該使用'Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Security'註釋。您確定此棄用警告是由於註釋引起的嗎?不應該有任何的警告只是從使用'@ Security'標籤在它自己的,因爲這承諾 - https://github.com/sensiolabs/SensioFrameworkExtraBundle/commit/675a6ea953c46721e57d692d17bb8d4a734b92f8 – qooplmao