@@ -12,16 +12,19 @@ you how to load your users from the database via a Doctrine entity.
12
12
Introduction
13
13
------------
14
14
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.
20
23
21
24
Loading users via a Doctrine entity has 2 basic steps:
22
25
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 >`
25
28
26
29
Afterwards, you can learn more about :ref: `forbidding inactive users <security-advanced-user-interface >`,
27
30
: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
111
114
{
112
115
}
113
116
114
- /** * @see \Serializable::serialize() */
117
+ /** @see \Serializable::serialize() */
115
118
public function serialize()
116
119
{
117
120
return serialize(array(
@@ -123,7 +126,7 @@ For this entry, suppose that you already have a ``User`` entity inside an
123
126
));
124
127
}
125
128
126
- /** * @see \Serializable::unserialize() */
129
+ /** @see \Serializable::unserialize() */
127
130
public function unserialize($serialized)
128
131
{
129
132
list (
@@ -174,7 +177,7 @@ On the next request, it's unserialized. To help PHP do this correctly, you
174
177
need to implement ``Serializable ``. But you don't need to serialize everything:
175
178
you only need a few fields (the ones shown above plus a few extra if you
176
179
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
178
181
from the database.
179
182
180
183
Want to know more? See :ref: `cookbook-security-serialize-equatable `.
@@ -771,3 +774,4 @@ or worry about it.
771
774
and the ``EquatableInterface `` was introduced in its place.
772
775
773
776
.. _fixtures : http://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html
777
+ .. _FOSUserBundle : https://github.com/FriendsOfSymfony/FOSUserBundle
0 commit comments