src/Entity/Session.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\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. #[ORM\Entity(repositoryClassSessionRepository::class)]
  10. class Session
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\ManyToOne]
  17.     private ?Sport $design null;
  18.     #[ORM\ManyToOne]
  19.     private ?Events $event null;
  20.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  21.     private ?\DateTimeInterface $date null;
  22.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)]
  23.     private ?\DateTimeInterface $heure_start null;
  24.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)]
  25.     private ?\DateTimeInterface $heure_end null;
  26.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  27.     private ?string $description null;
  28.     #[ORM\ManyToOne]
  29.     private ?SessionType $type null;
  30.     #[ORM\ManyToOne]
  31.     private ?Cour $cour null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $codeSession null;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $designationSession null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $typeSession null;
  38.     #[ORM\Column(nullabletrue)]
  39.     private ?float $first null;
  40.     #[ORM\Column(nullabletrue)]
  41.     private ?float $catA null;
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?float $catB null;
  44.     #[ORM\Column(nullabletrue)]
  45.     private ?float $catC null;
  46.     #[ORM\Column(nullabletrue)]
  47.     private ?float $catD null;
  48.     #[ORM\OneToMany(mappedBy'session'targetEntitySerieBillet::class, cascade: ['persist'], orphanRemovaltrue)]
  49.     private Collection $serieBillets;
  50.     public function __construct()
  51.     {
  52.         $this->serieBillets = new ArrayCollection();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getDesign(): ?Sport
  59.     {
  60.         return $this->design;
  61.     }
  62.     public function setDesign(?Sport $design): self
  63.     {
  64.         $this->design $design;
  65.         return $this;
  66.     }
  67.     public function getEvent(): ?Events
  68.     {
  69.         return $this->event;
  70.     }
  71.     public function setEvent(?Events $event): self
  72.     {
  73.         $this->event $event;
  74.         return $this;
  75.     }
  76.     public function getDate(): ?\DateTimeInterface
  77.     {
  78.         return $this->date;
  79.     }
  80.     public function setDate(?\DateTimeInterface $date): self
  81.     {
  82.         $this->date $date;
  83.         return $this;
  84.     }
  85.     public function getHeureStart(): ?\DateTimeInterface
  86.     {
  87.         return $this->heure_start;
  88.     }
  89.     public function setHeureStart(?\DateTimeInterface $heure_start): self
  90.     {
  91.         $this->heure_start $heure_start;
  92.         return $this;
  93.     }
  94.     public function getHeureEnd(): ?\DateTimeInterface
  95.     {
  96.         return $this->heure_end;
  97.     }
  98.     public function setHeureEnd(?\DateTimeInterface $heure_end): self
  99.     {
  100.         $this->heure_end $heure_end;
  101.         return $this;
  102.     }
  103.     public function getDescription(): ?string
  104.     {
  105.         return $this->description;
  106.     }
  107.     public function setDescription(?string $description): self
  108.     {
  109.         $this->description $description;
  110.         return $this;
  111.     }
  112.     public function getType(): ?SessionType
  113.     {
  114.         return $this->type;
  115.     }
  116.     public function setType(?SessionType $type): self
  117.     {
  118.         $this->type $type;
  119.         return $this;
  120.     }
  121.     public function getCour(): ?Cour
  122.     {
  123.         return $this->cour;
  124.     }
  125.     public function setCour(?Cour $cour): self
  126.     {
  127.         $this->cour $cour;
  128.         return $this;
  129.     }
  130.     public function getCodeSession(): ?string
  131.     {
  132.         return $this->codeSession;
  133.     }
  134.     public function setCodeSession(?string $codeSession): self
  135.     {
  136.         $this->codeSession $codeSession;
  137.         return $this;
  138.     }
  139.     public function getDesignationSession(): ?string
  140.     {
  141.         return $this->designationSession;
  142.     }
  143.     public function setDesignationSession($designationSession): self
  144.     {
  145.         $this->designationSession $designationSession;
  146.         return $this;
  147.     }
  148.     public function getTypeSession(): ?string
  149.     {
  150.         return $this->typeSession;
  151.     }
  152.     public function setTypeSession(?string $typeSession): self
  153.     {
  154.         $this->typeSession $typeSession;
  155.         return $this;
  156.     }
  157.     public function getFirst(): ?float
  158.     {
  159.         return $this->first;
  160.     }
  161.     public function setFirst(?float $first): self
  162.     {
  163.         $this->first $first;
  164.         return $this;
  165.     }
  166.     public function getCatA(): ?float
  167.     {
  168.         return $this->catA;
  169.     }
  170.     public function setCatA(?float $catA): self
  171.     {
  172.         $this->catA $catA;
  173.         return $this;
  174.     }
  175.     public function getCatB(): ?float
  176.     {
  177.         return $this->catB;
  178.     }
  179.     public function setCatB(?float $catB): self
  180.     {
  181.         $this->catB $catB;
  182.         return $this;
  183.     }
  184.     public function getCatC(): ?float
  185.     {
  186.         return $this->catC;
  187.     }
  188.     public function setCatC(?float $catC): self
  189.     {
  190.         $this->catC $catC;
  191.         return $this;
  192.     }
  193.     public function getCatD(): ?float
  194.     {
  195.         return $this->catD;
  196.     }
  197.     public function setCatD(?float $catD): self
  198.     {
  199.         $this->catD $catD;
  200.         return $this;
  201.     }
  202.     /**
  203.      * @return Collection<int, SerieBillet>
  204.      */
  205.     public function getSerieBillets(): Collection
  206.     {
  207.         return $this->serieBillets;
  208.     }
  209.     public function addSerieBillet(SerieBillet $serieBillet): self
  210.     {
  211.         if (!$this->serieBillets->contains($serieBillet)) {
  212.             $this->serieBillets->add($serieBillet);
  213.             $serieBillet->setSession($this);
  214.         }
  215.         return $this;
  216.     }
  217.     public function removeSerieBillet(SerieBillet $serieBillet): self
  218.     {
  219.         if ($this->serieBillets->removeElement($serieBillet)) {
  220.             // set the owning side to null (unless already changed)
  221.             if ($serieBillet->getSession() === $this) {
  222.                 $serieBillet->setSession(null);
  223.             }
  224.         }
  225.         return $this;
  226.     }
  227.     /**
  228.      * @return string
  229.      */
  230.     public function getSportName(): string
  231.     {
  232.         return $this->design->getName();
  233.     }
  234.     public function getLocalizedDate(): string
  235.     {
  236.         $formatter = new \IntlDateFormatter('fr_FR'\IntlDateFormatter::FULL\IntlDateFormatter::NONE'Europe/Paris'\IntlDateFormatter::GREGORIAN'EEEE dd MMMM yyyy');
  237.         return $formatter->format($this->getDate());
  238.     }
  239.     public function __toString() 
  240.     {
  241.         return (string) $this->codeSession
  242.     }
  243. }