src/Entity/GroupSession.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GroupSessionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=GroupSessionRepository::class)
  10.  */
  11. class GroupSession
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups("post-group-session")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\ManyToMany(targetEntity=User::class, inversedBy="groupSessions")
  22.      */
  23.     private $user;
  24.     /**
  25.      * @ORM\OneToMany(targetEntity=GroupSessionMessage::class, mappedBy="groupSession")
  26.      */
  27.     private $groupSessionMessages;
  28.     /**
  29.      * @ORM\Column(type="integer", nullable=true)
  30.      * @Groups("post-group-session")
  31.      */
  32.     private $idCourseSession;
  33.     /**
  34.      * @ORM\Column(type="boolean", nullable=true)
  35.      */
  36.     private $isActiveGroup;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity=Notification::class, mappedBy="groupSession")
  39.      */
  40.     private $notifications;
  41.     public function __construct()
  42.     {
  43.         $this->user = new ArrayCollection();
  44.         $this->groupSessionMessages = new ArrayCollection();
  45.         $this->notifications = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     /**
  52.      * @return Collection<int, User>
  53.      */
  54.     public function getUser(): Collection
  55.     {
  56.         return $this->user;
  57.     }
  58.     public function addUser(User $user): self
  59.     {
  60.         if (!$this->user->contains($user)) {
  61.             $this->user[] = $user;
  62.         }
  63.         return $this;
  64.     }
  65.     public function removeUser(User $user): self
  66.     {
  67.         $this->user->removeElement($user);
  68.         return $this;
  69.     }
  70.     /**
  71.      * @return Collection<int, GroupSessionMessage>
  72.      */
  73.     public function getGroupSessionMessages(): Collection
  74.     {
  75.         return $this->groupSessionMessages;
  76.     }
  77.     public function addGroupSessionMessage(GroupSessionMessage $groupSessionMessage): self
  78.     {
  79.         if (!$this->groupSessionMessages->contains($groupSessionMessage)) {
  80.             $this->groupSessionMessages[] = $groupSessionMessage;
  81.             $groupSessionMessage->setGroupSession($this);
  82.         }
  83.         return $this;
  84.     }
  85.     public function removeGroupSessionMessage(GroupSessionMessage $groupSessionMessage): self
  86.     {
  87.         if ($this->groupSessionMessages->removeElement($groupSessionMessage)) {
  88.             // set the owning side to null (unless already changed)
  89.             if ($groupSessionMessage->getGroupSession() === $this) {
  90.                 $groupSessionMessage->setGroupSession(null);
  91.             }
  92.         }
  93.         return $this;
  94.     }
  95.     /**
  96.      * Get the value of idCourseSession
  97.      */ 
  98.     public function getIdCourseSession()
  99.     {
  100.         return $this->idCourseSession;
  101.     }
  102.     /**
  103.      * Set the value of idCourseSession
  104.      *
  105.      * @return  self
  106.      */ 
  107.     public function setIdCourseSession($idCourseSession)
  108.     {
  109.         $this->idCourseSession $idCourseSession;
  110.         return $this;
  111.     }
  112.     public function getIsActiveGroup(): ?bool
  113.     {
  114.         return $this->isActiveGroup;
  115.     }
  116.     public function setIsActiveGroup(?bool $isActiveGroup): self
  117.     {
  118.         $this->isActiveGroup $isActiveGroup;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Collection<int, Notification>
  123.      */
  124.     public function getNotifications(): Collection
  125.     {
  126.         return $this->notifications;
  127.     }
  128.     public function addNotification(Notification $notification): self
  129.     {
  130.         if (!$this->notifications->contains($notification)) {
  131.             $this->notifications[] = $notification;
  132.             $notification->setGroupSession($this);
  133.         }
  134.         return $this;
  135.     }
  136.     public function removeNotification(Notification $notification): self
  137.     {
  138.         if ($this->notifications->removeElement($notification)) {
  139.             // set the owning side to null (unless already changed)
  140.             if ($notification->getGroupSession() === $this) {
  141.                 $notification->setGroupSession(null);
  142.             }
  143.         }
  144.         return $this;
  145.     }
  146. }