Skip to content

Commit 7153f3b

Browse files
committed
Many fixes thanks to stof, WouterJ, xabbuh and dupuchba
1 parent 768f7cc commit 7153f3b

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

cookbook/security/entity_provider.rst

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ you how to load your users from the database via a Doctrine entity.
1212
Introduction
1313
------------
1414

15-
Before you start, you should check out the `FOSUserBundle`_. This external
16-
bundle allows you to load users from the database (like you'll learn here)
17-
*and* gives you built-in routes and controllers for common things like login,
18-
registration and forgot password. Whether you use that bundle or go through
19-
the steps here is up to you.
15+
.. tip::
16+
17+
Before you start, you should check out `FOSUserBundle`_. This external
18+
bundle allows you to load users from the database (like you'll learn here)
19+
*and* gives you built-in routes & controllers for things like login,
20+
registration and forgot password. But, if you need to heavily customize
21+
your user system *or* if you want to learn how things work, this tutorial
22+
is even better.
2023

2124
Loading users via a Doctrine entity has 2 basic steps:
2225

23-
1. :ref:`Create your User entity <security-crete-user-entity>`
24-
2. :ref:`Configure security.yml to load from your entity <security-config-entity-provider>`
26+
#. :ref:`Create your User entity <security-crete-user-entity>`
27+
#. :ref:`Configure security.yml to load from your entity <security-config-entity-provider>`
2528

2629
Afterwards, you can learn more about :ref:`forbidding inactive users <security-advanced-user-interface>`,
2730
:ref:`using a custom query <authenticating-someone-with-a-custom-entity-provider>`
@@ -111,7 +114,7 @@ For this entry, suppose that you already have a ``User`` entity inside an
111114
{
112115
}
113116
114-
/** * @see \Serializable::serialize() */
117+
/** @see \Serializable::serialize() */
115118
public function serialize()
116119
{
117120
return serialize(array(
@@ -123,7 +126,7 @@ For this entry, suppose that you already have a ``User`` entity inside an
123126
));
124127
}
125128
126-
/** * @see \Serializable::unserialize() */
129+
/** @see \Serializable::unserialize() */
127130
public function unserialize($serialized)
128131
{
129132
list (
@@ -174,7 +177,7 @@ On the next request, it's unserialized. To help PHP do this correctly, you
174177
need to implement ``Serializable``. But you don't need to serialize everything:
175178
you only need a few fields (the ones shown above plus a few extra if you
176179
decide to implement :ref:`AdvancedUserInterface <security-advanced-user-interface>`).
177-
On each request, the ``username`` is used to query for a fresh ``User`` object
180+
On each request, the ``id`` is used to query for a fresh ``User`` object
178181
from the database.
179182

180183
Want to know more? See :ref:`cookbook-security-serialize-equatable`.
@@ -771,3 +774,4 @@ or worry about it.
771774
and the ``EquatableInterface`` was introduced in its place.
772775

773776
.. _fixtures: http://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html
777+
.. _FOSUserBundle: https://github.com/FriendsOfSymfony/FOSUserBundle

0 commit comments

Comments
 (0)