Skip to content

Commit f08d516

Browse files
committed
[#2199] Fixing issue to make the serialized data on the User object match up with how equals works
1 parent d4f59d4 commit f08d516

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cookbook/security/entity_provider.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ focus on the most important methods that come from the
138138
*/
139139
public function equals(UserInterface $user)
140140
{
141-
return $this->username === $user->getUsername();
141+
return $this->id === $user->getId();
142142
}
143143
144144
/**
@@ -176,7 +176,7 @@ interface forces the class to implement the six following methods:
176176

177177
For more details on each of these, see :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`.
178178

179-
To keep it simple, the ``equals()`` method just compares the ``username`` field
179+
To keep it simple, the ``equals()`` method just compares the ``id`` field
180180
but it's also possible to do more checks depending on the complexity of your
181181
data model. On the other hand, the ``eraseCredentials()`` method remains empty
182182
for the purposes of this tutorial.

0 commit comments

Comments
 (0)