<?phpnamespace App\Entity;use App\Repository\GroupSessionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;/** * @ORM\Entity(repositoryClass=GroupSessionRepository::class) */class GroupSession{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups("post-group-session") */ private $id; /** * @ORM\ManyToMany(targetEntity=User::class, inversedBy="groupSessions") */ private $user; /** * @ORM\OneToMany(targetEntity=GroupSessionMessage::class, mappedBy="groupSession") */ private $groupSessionMessages; /** * @ORM\Column(type="integer", nullable=true) * @Groups("post-group-session") */ private $idCourseSession; /** * @ORM\Column(type="boolean", nullable=true) */ private $isActiveGroup; /** * @ORM\OneToMany(targetEntity=Notification::class, mappedBy="groupSession") */ private $notifications; public function __construct() { $this->user = new ArrayCollection(); $this->groupSessionMessages = new ArrayCollection(); $this->notifications = new ArrayCollection(); } public function getId(): ?int { return $this->id; } /** * @return Collection<int, User> */ public function getUser(): Collection { return $this->user; } public function addUser(User $user): self { if (!$this->user->contains($user)) { $this->user[] = $user; } return $this; } public function removeUser(User $user): self { $this->user->removeElement($user); return $this; } /** * @return Collection<int, GroupSessionMessage> */ public function getGroupSessionMessages(): Collection { return $this->groupSessionMessages; } public function addGroupSessionMessage(GroupSessionMessage $groupSessionMessage): self { if (!$this->groupSessionMessages->contains($groupSessionMessage)) { $this->groupSessionMessages[] = $groupSessionMessage; $groupSessionMessage->setGroupSession($this); } return $this; } public function removeGroupSessionMessage(GroupSessionMessage $groupSessionMessage): self { if ($this->groupSessionMessages->removeElement($groupSessionMessage)) { // set the owning side to null (unless already changed) if ($groupSessionMessage->getGroupSession() === $this) { $groupSessionMessage->setGroupSession(null); } } return $this; } /** * Get the value of idCourseSession */ public function getIdCourseSession() { return $this->idCourseSession; } /** * Set the value of idCourseSession * * @return self */ public function setIdCourseSession($idCourseSession) { $this->idCourseSession = $idCourseSession; return $this; } public function getIsActiveGroup(): ?bool { return $this->isActiveGroup; } public function setIsActiveGroup(?bool $isActiveGroup): self { $this->isActiveGroup = $isActiveGroup; return $this; } /** * @return Collection<int, Notification> */ public function getNotifications(): Collection { return $this->notifications; } public function addNotification(Notification $notification): self { if (!$this->notifications->contains($notification)) { $this->notifications[] = $notification; $notification->setGroupSession($this); } return $this; } public function removeNotification(Notification $notification): self { if ($this->notifications->removeElement($notification)) { // set the owning side to null (unless already changed) if ($notification->getGroupSession() === $this) { $notification->setGroupSession(null); } } return $this; }}