]> Raphaël G. Git Repositories - userbundle/commitdiff
Add slug
authorRaphaël Gertz <git@rapsys.eu>
Mon, 23 Aug 2021 07:26:42 +0000 (09:26 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Mon, 23 Aug 2021 07:26:42 +0000 (09:26 +0200)
Cleanup

Entity/User.php

index 549b176a290795e79b11866919e0044ae7b7afd5..c4c14df4f5c8240c264f3c1df9279fcd6a32f2df 100644 (file)
@@ -12,6 +12,7 @@
 namespace Rapsys\UserBundle\Entity;
 
 use Doctrine\Common\Collections\ArrayCollection;
+use Doctrine\ORM\Event\PreUpdateEventArgs;
 use Symfony\Component\Security\Core\User\UserInterface;
 
 use Rapsys\UserBundle\Entity\Civility;
@@ -51,6 +52,11 @@ class User implements UserInterface, \Serializable {
         */
        protected $password;
 
+       /**
+        * @var string
+        */
+       protected $slug;
+
        /**
         * @var bool
         */
@@ -214,6 +220,28 @@ class User implements UserInterface, \Serializable {
                return $this->password;
        }
 
+       /**
+        * Set slug
+        *
+        * @param string $slug
+        *
+        * @return User
+        */
+       public function setSlug(?string $slug): User {
+               $this->slug = $slug;
+
+               return $this;
+       }
+
+       /**
+        * Get slug
+        *
+        * @return string
+        */
+       public function getSlug(): ?string {
+               return $this->slug;
+       }
+
        /**
         * Set active
         *
@@ -465,7 +493,7 @@ class User implements UserInterface, \Serializable {
        /**
         * {@inheritdoc}
         */
-       public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs $eventArgs) {
+       public function preUpdate(PreUpdateEventArgs $eventArgs) {
                //Check that we have an user instance
                if (($user = $eventArgs->getEntity()) instanceof User) {
                        //Set updated value