From: Raphaƫl Gertz Date: Mon, 23 Aug 2021 07:26:42 +0000 (+0200) Subject: Add slug X-Git-Tag: 0.2.0~36 X-Git-Url: https://git.rapsys.eu/userbundle/commitdiff_plain/dedb94306e39d1d64f8b970a366a16cfb68c16dc Add slug Cleanup --- diff --git a/Entity/User.php b/Entity/User.php index 549b176..c4c14df 100644 --- a/Entity/User.php +++ b/Entity/User.php @@ -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