src/Entity/Competition.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CompetitionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCompetitionRepository::class)]
  8. class Competition
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $title;
  16.     #[ORM\ManyToOne(targetEntityCity::class, inversedBy'competitions')]
  17.     private $city;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private $hall;
  20.     #[ORM\Column(type'date')]
  21.     private $date;
  22.     #[ORM\Column(type'date'nullabletrue)]
  23.     private $checkin;
  24.     #[ORM\Column(type'date'nullabletrue)]
  25.     private $checkout;
  26.     #[ORM\Column(type'datetime'nullabletrue)]
  27.     private $deadline;
  28.     #[ORM\Column(type'integer'nullabletrue)]
  29.     private $timezone;
  30.     #[ORM\OneToMany(mappedBy'competition'targetEntityAttribution::class)]
  31.     private $attributions;
  32.     #[ORM\Column(type'string'length255nullabletrue)]
  33.     private $brochureFile;
  34.     #[ORM\Column(type'date'nullabletrue)]
  35.     private $dateend;
  36.     public function __construct()
  37.     {
  38.         $this->attributions = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getTitle(): ?string
  45.     {
  46.         return $this->title;
  47.     }
  48.     public function setTitle(string $title): self
  49.     {
  50.         $this->title $title;
  51.         return $this;
  52.     }
  53.     public function getCity(): ?City
  54.     {
  55.         return $this->city;
  56.     }
  57.     public function setCity(?City $city): self
  58.     {
  59.         $this->city $city;
  60.         return $this;
  61.     }
  62.     public function getHall(): ?string
  63.     {
  64.         return $this->hall;
  65.     }
  66.     public function setHall(?string $hall): self
  67.     {
  68.         $this->hall $hall;
  69.         return $this;
  70.     }
  71.     public function getDate(): ?\DateTimeInterface
  72.     {
  73.         return $this->date;
  74.     }
  75.     public function setDate(\DateTimeInterface $date): self
  76.     {
  77.         $this->date $date;
  78.         return $this;
  79.     }
  80.     public function getCheckin(): ?\DateTimeInterface
  81.     {
  82.         return $this->checkin;
  83.     }
  84.     public function setCheckin(?\DateTimeInterface $checkin): self
  85.     {
  86.         $this->checkin $checkin;
  87.         return $this;
  88.     }
  89.     public function getCheckout(): ?\DateTimeInterface
  90.     {
  91.         return $this->checkout;
  92.     }
  93.     public function setCheckout(?\DateTimeInterface $checkout): self
  94.     {
  95.         $this->checkout $checkout;
  96.         return $this;
  97.     }
  98.     public function getDeadline(): ?\DateTimeInterface
  99.     {
  100.         return $this->deadline;
  101.     }
  102.     public function setDeadline(?\DateTimeInterface $deadline): self
  103.     {
  104.         $this->deadline $deadline;
  105.         return $this;
  106.     }
  107.     public function getTimezone(): ?int
  108.     {
  109.         return $this->timezone;
  110.     }
  111.     public function setTimezone(?int $timezone): self
  112.     {
  113.         $this->timezone $timezone;
  114.         return $this;
  115.     }
  116.     /**
  117.      * @return Collection|Attribution[]
  118.      */
  119.     public function getAttributions(): Collection
  120.     {
  121.         return $this->attributions;
  122.     }
  123.     public function addAttribution(Attribution $attribution): self
  124.     {
  125.         if (!$this->attributions->contains($attribution)) {
  126.             $this->attributions[] = $attribution;
  127.             $attribution->setCompetition($this);
  128.         }
  129.         return $this;
  130.     }
  131.     public function removeAttribution(Attribution $attribution): self
  132.     {
  133.         if ($this->attributions->removeElement($attribution)) {
  134.             // set the owning side to null (unless already changed)
  135.             if ($attribution->getCompetition() === $this) {
  136.                 $attribution->setCompetition(null);
  137.             }
  138.         }
  139.         return $this;
  140.     }
  141.     public function getTimeLeft()
  142.     {
  143.         $deadline $this->getDeadline();
  144.         return [
  145.             'Y' => $deadline->format('Y'),
  146.             'm' => $deadline->format('m'),
  147.             'd' => $deadline->format('d'),
  148.             'h' => $deadline->format('h'),
  149.             'i' => $deadline->format('i'),
  150.             's' => $deadline->format('s')
  151.         ];
  152.     }
  153.     public function __toString()
  154.     {
  155.         return $this->title;
  156.     }
  157.     public function getBrochureFile(): ?string
  158.     {
  159.         return $this->brochureFile;
  160.     }
  161.     public function setBrochureFile(?string $brochureFile): self
  162.     {
  163.         $this->brochureFile $brochureFile;
  164.         return $this;
  165.     }
  166.     public function getDateend(): ?\DateTimeInterface
  167.     {
  168.         return $this->dateend;
  169.     }
  170.     public function setDateend(?\DateTimeInterface $dateend): self
  171.     {
  172.         $this->dateend $dateend;
  173.         return $this;
  174.     }
  175. }