diff --git a/src/Symfony/Component/Security/CHANGELOG.md b/src/Symfony/Component/Security/CHANGELOG.md index 797462b4e8..8c98be19f6 100644 --- a/src/Symfony/Component/Security/CHANGELOG.md +++ b/src/Symfony/Component/Security/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.1.0 ----- + * Added the Serializable interface on the Role class * [BC BREAK] The signature of ExceptionListener has changed * changed the HttpUtils constructor signature to take a UrlGenerator and a UrlMatcher instead of a Router * EncoderFactoryInterface::getEncoder() can now also take a class name as an argument diff --git a/src/Symfony/Component/Security/Core/Role/Role.php b/src/Symfony/Component/Security/Core/Role/Role.php index 5b50981fe1..7f16302b64 100644 --- a/src/Symfony/Component/Security/Core/Role/Role.php +++ b/src/Symfony/Component/Security/Core/Role/Role.php @@ -17,7 +17,7 @@ namespace Symfony\Component\Security\Core\Role; * * @author Fabien Potencier */ -class Role implements RoleInterface +class Role implements RoleInterface, \Serializable { private $role; @@ -38,4 +38,20 @@ class Role implements RoleInterface { return $this->role; } + + /** + * {@inheritdoc} + */ + public function serialize() + { + return serialize($this->role); + } + + /** + * {@inheritdoc} + */ + public function unserialize($serialized) + { + $this->role = unserialize($serialized); + } }