src/Entity/SessionCollection.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SessionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SessionRepository::class)
  9.  */
  10. class SessionCollection
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=Site::class, inversedBy="sessions")
  20.      * @ORM\JoinColumn(nullable=false)
  21.      */
  22.     private $site;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Formation::class, inversedBy="sessions")
  25.      * @ORM\JoinColumn(nullable=false)
  26.      */
  27.     private $formation;
  28.     
  29.    
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=SessionMasse::class, mappedBy="sessionCollection", orphanRemoval=true)
  32.      */
  33.     private $sessions;
  34.     
  35.     public function __construct()
  36.     {
  37.         $this->sessions = new ArrayCollection();
  38.     }
  39.     
  40.     public function getSite(): ?Site
  41.     {
  42.         return $this->site;
  43.     }
  44.     public function setSite(?Site $site): self
  45.     {
  46.         $this->site $site;
  47.         return $this;
  48.     }
  49.     public function getFormation(): ?Formation
  50.     {
  51.         return $this->formation;
  52.     }
  53.     public function setFormation(?Formation $formation): self
  54.     {
  55.         $this->formation $formation;
  56.         return $this;
  57.     }
  58.    
  59.      /**
  60.      * @return Collection<int, SessionMasse>
  61.      */
  62.     public function getSessions(): Collection
  63.     {
  64.         return $this->sessions;
  65.     }
  66.     public function addSession(SessionMasse $session): self
  67.     {
  68.         if (!$this->sessions->contains($session)) {
  69.             $this->sessions[] = $session;
  70.         }
  71.         return $this;
  72.     }
  73.     public function removeSession(SessionMasse $sessions): self
  74.     {
  75.         $this->sessions->removeElement($sessions);
  76.         return $this;
  77.     }
  78.    
  79. }