diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst
index bca65414289..96ad27b401e 100644
--- a/cookbook/security/entity_provider.rst
+++ b/cookbook/security/entity_provider.rst
@@ -240,7 +240,7 @@ the username and then check the password (more on passwords in a moment):
-
+
@@ -474,7 +474,7 @@ For more details on these methods, see :class:`Symfony\\Component\\Security\\Cor
.. tip::
- Don't forget to add the repository class to the
+ Don't forget to add the repository class to the
:ref:`mapping definition of your entity `.
To finish this, just remove the ``property`` key from the user provider in
@@ -720,7 +720,8 @@ fetch the user and their associated roles with a single query::
->where('u.username = :username OR u.email = :email')
->setParameter('username', $username)
->setParameter('email', $username)
- ->getQuery();
+ ->getQuery()
+ ->getOneOrNullResult();
// ...
}