Commit 3f460c17 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

AbstractRole: ajout intialisation indispensable de la collection users + ajout méthode removeUser

parent c81dccb5
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace UnicaenAuth\Entity\Db; namespace UnicaenAuth\Entity\Db;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
...@@ -53,6 +54,14 @@ abstract class AbstractRole implements RoleInterface ...@@ -53,6 +54,14 @@ abstract class AbstractRole implements RoleInterface
*/ */
protected $users; protected $users;
/**
* AbstractRole constructor.
*/
public function __construct()
{
$this->users = new ArrayCollection();
}
/** /**
* Get the id. * Get the id.
* *
...@@ -191,6 +200,14 @@ abstract class AbstractRole implements RoleInterface ...@@ -191,6 +200,14 @@ abstract class AbstractRole implements RoleInterface
$this->users[] = $user; $this->users[] = $user;
} }
/**
* @param UserInterface $user
*/
public function removeUser(UserInterface $user)
{
$this->users->removeElement($user);
}
/** /**
* *
* @return string * @return string
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment