Skip to content

Commit b55930a

Browse files
committed
[Security] Implemented the Serializable interface in the Role class
1 parent 28abff8 commit b55930a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Symfony/Component/Security/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
2.1.0
55
-----
66

7+
* Added the Serializable interface on the Role class
78
* [BC BREAK] The signature of ExceptionListener has changed
89
* changed the HttpUtils constructor signature to take a UrlGenerator and a UrlMatcher instead of a Router
910
* EncoderFactoryInterface::getEncoder() can now also take a class name as an argument

src/Symfony/Component/Security/Core/Role/Role.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @author Fabien Potencier <fabien@symfony.com>
1919
*/
20-
class Role implements RoleInterface
20+
class Role implements RoleInterface, \Serializable
2121
{
2222
private $role;
2323

@@ -38,4 +38,20 @@ public function getRole()
3838
{
3939
return $this->role;
4040
}
41+
42+
/**
43+
* {@inheritdoc}
44+
*/
45+
public function serialize()
46+
{
47+
return serialize($this->role);
48+
}
49+
50+
/**
51+
* {@inheritdoc}
52+
*/
53+
public function unserialize($serialized)
54+
{
55+
$this->role = unserialize($serialized);
56+
}
4157
}

0 commit comments

Comments
 (0)