@@ -149,6 +149,9 @@ focus on the most important methods that come from the
149
149
{
150
150
return serialize(array(
151
151
$this->id,
152
+ $this->username,
153
+ $this->salt,
154
+ $this->password,
152
155
));
153
156
}
154
157
@@ -159,10 +162,20 @@ focus on the most important methods that come from the
159
162
{
160
163
list (
161
164
$this->id,
165
+ $this->username,
166
+ $this->salt,
167
+ $this->password,
162
168
) = unserialize($serialized);
163
169
}
164
170
}
165
171
172
+ .. note ::
173
+
174
+ When implementing the
175
+ :class: `Symfony\\ Component\\ Security\\ Core\\ User\\ EquatableInterface `,
176
+ you determine yourself which properties need to be compared to distinguish
177
+ your user objects.
178
+
166
179
.. tip ::
167
180
168
181
:ref: `Generate the database table <book-doctrine-creating-the-database-tables-schema >`
@@ -219,7 +232,7 @@ layer is a piece of cake. Everything resides in the configuration of the
219
232
:doc:` SecurityBundle < /reference/configuration/security> ` stored in the
220
233
` ` app/config/security.yml` ` file.
221
234
222
- Below is an example of configuration where the user will enter their
235
+ Below is an example of configuration where the user will enter their
223
236
username and password via HTTP basic authentication. That information will
224
237
then be checked against your User entity records in the database:
225
238
@@ -358,7 +371,7 @@ For this example, the first three methods will return ``true`` whereas the
358
371
use Doctrine\O RM\M apping as ORM;
359
372
use Symfony\C omponent\S ecurity\C ore\U ser\A dvancedUserInterface;
360
373
361
- class User implements AdvancedUserInterface, \S erializable
374
+ class User implements AdvancedUserInterface, \S erializable
362
375
{
363
376
// ...
364
377
@@ -386,7 +399,7 @@ For this example, the first three methods will return ``true`` whereas the
386
399
Now, if you try to authenticate as a user who' s ``is_active`` database field
387
400
is set to 0, you won' t be allowed.
388
401
389
- The next session will focus on how to write a custom entity provider
402
+ The next session will focus on how to write a custom entity provider
390
403
to authenticate a user with their username or email address.
391
404
392
405
Authenticating Someone with a Custom Entity Provider
@@ -552,7 +565,7 @@ methods have changed::
552
565
class User implements AdvancedUserInterface, \Serializable
553
566
{
554
567
// ...
555
-
568
+
556
569
/**
557
570
* @ORM\ManyToMany(targetEntity="Role", inversedBy="users")
558
571
*
@@ -568,7 +581,7 @@ methods have changed::
568
581
{
569
582
return $this->roles->toArray();
570
583
}
571
-
584
+
572
585
// ...
573
586
574
587
}
@@ -625,7 +638,7 @@ of the application::
625
638
{
626
639
return $this->role;
627
640
}
628
-
641
+
629
642
// ... getters and setters for each property
630
643
}
631
644
0 commit comments