1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys PackBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\UserBundle\Entity
;
14 use Doctrine\Common\Collections\ArrayCollection
;
16 use Rapsys\UserBundle\Entity\User
;
43 * @var ArrayCollection
50 * @param string $title The group name
52 public function __construct(string $title) {
53 $this->title
= $title;
54 $this->users
= new ArrayCollection();
62 public function getId(): int {
69 * @param string $title The group name
73 public function setTitle(string $title): Group
{
74 $this->title
= $title;
84 public function getTitle(): ?string {
91 * @param \DateTime $created
95 public function setCreated(\DateTime
$created): Group
{
96 $this->created
= $created;
106 public function getCreated(): \DateTime
{
107 return $this->created
;
113 * @param \DateTime $updated
117 public function setUpdated(\DateTime
$updated): Group
{
118 $this->updated
= $updated;
128 public function getUpdated(): \DateTime
{
129 return $this->updated
;
139 public function addUser(User
$user) {
140 $this->users
[] = $user;
150 public function removeUser(User
$user) {
151 $this->users
->removeElement($user);
157 * @return ArrayCollection
159 public function getUsers(): ArrayCollection
{
164 * Returns a string representation of the group
168 public function __toString(): string {
177 public function getRole(): string {
178 return 'ROLE_'.strtoupper($this->title
);