src/Entity/Sport.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SportRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassSportRepository::class)]
  8. class Sport
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $name;
  16.     #[ORM\Column(type'string'length255)]
  17.     private $slug;
  18.     #[ORM\Column(type'string'length255)]
  19.     private $icon;
  20.     #[ORM\OneToMany(targetEntityCourtInfo::class, mappedBy'sport')]
  21.     private $courtInfos;
  22.     #[ORM\ManyToMany(targetEntityProInfo::class, mappedBy'sports')]
  23.     private $pros;
  24.     
  25.     #[ORM\OneToMany(targetEntitySportTrainee::class, mappedBy'sport')]
  26.     private $trainees;
  27.     #[ORM\ManyToMany(targetEntityCourse::class, mappedBy'sports')]
  28.     private $courses;
  29.     #[ORM\OneToMany(targetEntityAvailability::class, mappedBy'sport')]
  30.     private $availabilities;
  31.     #[ORM\Column(type'string'length255nullabletrue)]
  32.     private $status;
  33.     #[ORM\Column(type'integer'nullabletrue)]
  34.     private $appearance;
  35.     public function __construct()
  36.     {
  37.         $this->courtInfos = new ArrayCollection();
  38.         $this->pros = new ArrayCollection();
  39.         $this->trainees = new ArrayCollection();
  40.         $this->courses = new ArrayCollection();
  41.         $this->availabilities = new ArrayCollection();
  42.     }
  43.     public function __toString()
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getName(): ?string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function setName(string $name): self
  56.     {
  57.         $this->name $name;
  58.         return $this;
  59.     }
  60.     public function getSlug(): ?string
  61.     {
  62.         return $this->slug;
  63.     }
  64.     public function setSlug(string $slug): self
  65.     {
  66.         $this->slug $slug;
  67.         return $this;
  68.     }
  69.     public function getIcon()
  70.     {
  71.         return $this->icon;
  72.     }
  73.     public function setIcon($icon): self
  74.     {
  75.         $this->icon $icon;
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return Collection|CourtInfo[]
  80.      */
  81.     public function getCourtInfos(): Collection
  82.     {
  83.         return $this->courtInfos;
  84.     }
  85.     public function addCourtInfo(CourtInfo $courtInfo): self
  86.     {
  87.         if (!$this->courtInfos->contains($courtInfo)) {
  88.             $this->courtInfos[] = $courtInfo;
  89.             $courtInfo->setSport($this);
  90.         }
  91.         return $this;
  92.     }
  93.     public function removeCourtInfo(CourtInfo $courtInfo): self
  94.     {
  95.         if ($this->courtInfos->removeElement($courtInfo)) {
  96.             // set the owning side to null (unless already changed)
  97.             if ($courtInfo->getSport() === $this) {
  98.                 $courtInfo->setSport(null);
  99.             }
  100.         }
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return Collection|ProInfo[]
  105.      */
  106.     public function getPros(): Collection
  107.     {
  108.         return $this->pros;
  109.     }
  110.     public function addPro(ProInfo $pro): self
  111.     {
  112.         if (!$this->pros->contains($pro)) {
  113.             $this->pros[] = $pro;
  114.             $pro->addSport($this);
  115.         }
  116.         return $this;
  117.     }
  118.     public function removePro(ProInfo $pro): self
  119.     {
  120.         if ($this->pros->removeElement($pro)) {
  121.             $pro->removeSport($this);
  122.         }
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection|SportTrainee[]
  127.      */
  128.     public function getTrainees(): Collection
  129.     {
  130.         return $this->trainees;
  131.     }
  132.     public function addTrainee(SportTrainee $trainee): self
  133.     {
  134.         if (!$this->trainees->contains($trainee)) {
  135.             $this->trainees[] = $trainee;
  136.             $trainee->setSport($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removeTrainee(SportTrainee $trainee): self
  141.     {
  142.         if ($this->trainees->removeElement($trainee)) {
  143.             // set the owning side to null (unless already changed)
  144.             if ($trainee->getSport() === $this) {
  145.                 $trainee->setSport(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection|Course[]
  152.      */
  153.     public function getCourses(): Collection
  154.     {
  155.         return $this->courses;
  156.     }
  157.     public function addCourse(Course $course): self
  158.     {
  159.         if (!$this->courses->contains($course)) {
  160.             $this->courses[] = $course;
  161.             $course->addSport($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeCourse(Course $course): self
  166.     {
  167.         if ($this->courses->removeElement($course)) {
  168.             $course->removeSport($this);
  169.         }
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return Collection|Availability[]
  174.      */
  175.     public function getAvailabilities(): Collection
  176.     {
  177.         return $this->availabilities;
  178.     }
  179.     public function addAvailability(Availability $availability): self
  180.     {
  181.         if (!$this->availabilities->contains($availability)) {
  182.             $this->availabilities[] = $availability;
  183.             $availability->setSport($this);
  184.         }
  185.         return $this;
  186.     }
  187.     public function removeAvailability(Availability $availability): self
  188.     {
  189.         if ($this->availabilities->removeElement($availability)) {
  190.             // set the owning side to null (unless already changed)
  191.             if ($availability->getSport() === $this) {
  192.                 $availability->setSport(null);
  193.             }
  194.         }
  195.         return $this;
  196.     }
  197.     public function getStatus(): ?string
  198.     {
  199.         return $this->status;
  200.     }
  201.     public function setStatus(?string $status): self
  202.     {
  203.         $this->status $status;
  204.         return $this;
  205.     }
  206.     public function getAppearance(): ?int
  207.     {
  208.         return $this->appearance;
  209.     }
  210.     public function setAppearance(?int $appearance): self
  211.     {
  212.         $this->appearance $appearance;
  213.         return $this;
  214.     }
  215. }