Skip to content

Commit ae9358e

Browse files
committed
added an example code snippet
1 parent 24904c0 commit ae9358e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cookbook/security/entity_provider.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,21 @@ For more details on each of these, see :class:`Symfony\\Component\\Security\\Cor
155155
implement the new :class:`Symfony\\Component\\Security\\Core\\User\\EquatableInterface`
156156
interface and implement the ``isEqualTo`` method.
157157

158+
.. code-block:: php
159+
160+
// src/Acme/UserBundle/Entity/User.php
161+
162+
namespace Acme\UserBundle\Entity;
163+
164+
use Symfony\Component\Security\Core\User\EquatableInterface;
165+
166+
// ...
167+
168+
public function isEqualTo(UserInterface $user)
169+
{
170+
return $this->username === $user->getUsername();
171+
}
172+
158173
Below is an export of my ``User`` table from MySQL. For details on how to
159174
create user records and encode their password, see :ref:`book-security-encoding-user-password`.
160175

0 commit comments

Comments
 (0)