]> Raphaël G. Git Repositories - userbundle/commitdiff
Implement Serializable interface
authorRaphaël Gertz <git@rapsys.eu>
Mon, 3 Oct 2022 00:17:00 +0000 (02:17 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Mon, 3 Oct 2022 00:17:00 +0000 (02:17 +0200)
Entity/User.php

index 61be1051684af4a8e533d809413d1aa558eb3c9b..8103ea6bcd111d26ad5592eb046022f5ce3ed89e 100644 (file)
@@ -22,7 +22,7 @@ use Rapsys\UserBundle\Entity\Group;
 /**
  * User
  */
-class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serializable {
+class User implements UserInterface, PasswordAuthenticatedUserInterface {
        /**
         * @var integer
         */
@@ -435,8 +435,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serial
        /**
         * {@inheritdoc}
         */
-       public function serialize(): string {
-               return serialize([
+       public function __serialize(): array {
+               return [
                        $this->id,
                        $this->mail,
                        $this->forename,
@@ -446,13 +446,13 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serial
                        $this->disabled,
                        $this->created,
                        $this->updated
-               ]);
+               ];
        }
 
        /**
         * {@inheritdoc}
         */
-       public function unserialize($serialized) {
+       public function __unserialize(array $data): void {
                list(
                        $this->id,
                        $this->mail,
@@ -463,7 +463,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, \Serial
                        $this->disabled,
                        $this->created,
                        $this->updated
-               ) = unserialize($serialized);
+               ) = $data;
        }
 
        /**