@@ -740,8 +740,8 @@ address or username.
740
740
Understanding serialize and how a User is Saved in the Session
741
741
--------------------------------------------------------------
742
742
743
- If you' re curious about the importance of the ``serialize`` method inside
744
- the User class or how the User object is serialized or deserialized, then
743
+ If you' re curious about the importance of the ``serialize() `` method inside
744
+ the `` User`` class or how the User object is serialized or deserialized, then
745
745
this section is for you. If not, feel free to skip this.
746
746
747
747
Once the user is logged in, the entire User object is serialized into the
@@ -757,18 +757,17 @@ Even though this all happens automatically, there are a few important side-effec
757
757
First, the :phpclass:` Serializable` interface and its ` ` serialize` ` and ` ` unserialize` `
758
758
methods have been added to allow the ` ` User` ` class to be serialized
759
759
to the session. This may or may not be needed depending on your setup,
760
- but it' s probably a good idea. Only the ``id`` needs to be serialized,
760
+ but it' s probably a good idea. In theory, only the ``id`` needs to be serialized,
761
761
because the :method:`Symfony\\Bridge\\Doctrine\\Security\\User\\EntityUserProvider::refreshUser`
762
762
method refreshes the user on each request by using the ``id`` (as explained
763
- above). In practice, this means that the User object is reloaded from the
764
- database on each request using the ``id`` from the serialized object. This
765
- makes sure all of the User' s data is fresh.
766
-
763
+ above). However in practice, this means that the User object is reloaded from
764
+ the database on each request using the ``id`` from the serialized object.
765
+ This makes sure all of the User' s data is fresh.
767
766
768
767
Symfony also uses the ` ` username` ` , ` ` salt` ` , and ` ` password` ` to verify
769
768
that the User has not changed between requests. Failing to serialize
770
769
these may cause you to be logged out on each request. If your User implements
771
- :class:` Symfony\\ Component\\ Security\\ Core\\ User\\ EquatableInterface` ,
770
+ the :class:` Symfony\\ Component\\ Security\\ Core\\ User\\ EquatableInterface` ,
772
771
then instead of these properties being checked, your ` ` isEqualTo` ` method
773
772
is simply called, and you can check whatever properties you want. Unless
774
773
you understand this, you probably * won' t* need to implement this interface
0 commit comments