From dedb94306e39d1d64f8b970a366a16cfb68c16dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Mon, 23 Aug 2021 09:26:42 +0200 Subject: [PATCH] Add slug Cleanup --- Entity/User.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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 -- 2.41.1