18. New in Symfony2.6
Deprecated the security.context service
After some community discussions, it was decided that SecurityContext gives too many dependencies to retrieve
a simple Token/User object.
That's why, starting with Symfony 2.6, the security.context service has been deprecated and split into two new
services: security.authorization_checker and security.token_storage.
Since this is a 100% backwards compatible change, you don't have to update the code of your applications.
However, in case you want to do it, the changes are subtle:
// Symfony 2.5
$user = $this->get('security.context')->getToken()->getUser();
// Symfony 2.6
$user = $this->get('security.token_storage')->getToken()->getUser();
// Symfony 2.5
if (false === $this->get('security.context')->isGranted('ROLE_ADMIN')) { ... }
// Symfony 2.6
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) { ... }