From 3f460c17ff971bc02314568a00f7160e5c61c999 Mon Sep 17 00:00:00 2001 From: Bertrand Gauthier <bertrand.gauthier@unicaen.fr> Date: Wed, 30 May 2018 15:54:42 +0200 Subject: [PATCH] =?UTF-8?q?AbstractRole:=20ajout=20intialisation=20indispe?= =?UTF-8?q?nsable=20de=20la=20collection=20users=20+=20ajout=20m=C3=A9thod?= =?UTF-8?q?e=20removeUser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UnicaenAuth/Entity/Db/AbstractRole.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/UnicaenAuth/Entity/Db/AbstractRole.php b/src/UnicaenAuth/Entity/Db/AbstractRole.php index aaa2e6c..ba21199 100644 --- a/src/UnicaenAuth/Entity/Db/AbstractRole.php +++ b/src/UnicaenAuth/Entity/Db/AbstractRole.php @@ -2,6 +2,7 @@ namespace UnicaenAuth\Entity\Db; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** @@ -53,6 +54,14 @@ abstract class AbstractRole implements RoleInterface */ protected $users; + /** + * AbstractRole constructor. + */ + public function __construct() + { + $this->users = new ArrayCollection(); + } + /** * Get the id. * @@ -191,6 +200,14 @@ abstract class AbstractRole implements RoleInterface $this->users[] = $user; } + /** + * @param UserInterface $user + */ + public function removeUser(UserInterface $user) + { + $this->users->removeElement($user); + } + /** * * @return string -- GitLab