src/Core/Entity/Competition.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Core\Entity;
  3. use App\Core\DataObjectInterface\CompetitionInterface;
  4. use App\Core\Repository\CompetitionRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CompetitionRepository::class)
  10.  */
  11. class Competition implements CompetitionInterface
  12. {
  13.     public const STATE_SCHEDULED 'scheduled';
  14.     public const STATE_IN_PROGRESS 'in_progress';
  15.     public const COMPETITION_STATES = [
  16.         self::STATE_SCHEDULED,
  17.         self::STATE_IN_PROGRESS,
  18.     ];
  19.     /**
  20.      * @ORM\Id()
  21.      * @ORM\GeneratedValue()
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private int $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      */
  28.     private string $name;
  29.     /**
  30.      * @ORM\Column(type="integer", length=11)
  31.      */
  32.     private string $externalId;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private string $state self::STATE_SCHEDULED;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity="Tournament")
  39.      * @ORM\JoinColumn(name="tournament_id", referencedColumnName="id")
  40.      */
  41.     private Tournament $tournament;
  42.     /**
  43.      * @ORM\ManyToMany(targetEntity="Team", mappedBy="competitions")
  44.      */
  45.     private Collection $teams;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity="MatchFormat", mappedBy="competition")
  48.      */
  49.     private Collection $formats;
  50.     public function __construct()
  51.     {
  52.         $this->formats = new ArrayCollection();
  53.     }
  54.     public function getId(): int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getName(): string
  59.     {
  60.         return $this->name;
  61.     }
  62.     public function setName(string $name): self
  63.     {
  64.         $this->name $name;
  65.         return $this;
  66.     }
  67.     public function getExternalId(): int
  68.     {
  69.         return $this->externalId;
  70.     }
  71.     public function setExternalId(int $externalId): self
  72.     {
  73.         $this->externalId $externalId;
  74.         return $this;
  75.     }
  76.     public function getState(): string
  77.     {
  78.         return $this->state;
  79.     }
  80.     public function setState(string $state): self
  81.     {
  82.         $this->state $state;
  83.         return $this;
  84.     }
  85.     public function getTournament(): Tournament
  86.     {
  87.         return $this->tournament;
  88.     }
  89.     public function setTournament(Tournament $tournament): self
  90.     {
  91.         $this->tournament $tournament;
  92.         return $this;
  93.     }
  94.     public function getTeams(): Collection
  95.     {
  96.         return $this->teams;
  97.     }
  98.     public function setTeams(Collection $teams): self
  99.     {
  100.         $this->teams $teams;
  101.         return $this;
  102.     }
  103.     public function getFormats(): Collection
  104.     {
  105.         return $this->formats;
  106.     }
  107. }