<?php
namespace App\Entity;
use App\Repository\SportRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SportRepository::class)]
class Sport
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'string', length: 255)]
private $slug;
#[ORM\Column(type: 'string', length: 255)]
private $icon;
#[ORM\OneToMany(targetEntity: CourtInfo::class, mappedBy: 'sport')]
private $courtInfos;
#[ORM\ManyToMany(targetEntity: ProInfo::class, mappedBy: 'sports')]
private $pros;
#[ORM\OneToMany(targetEntity: SportTrainee::class, mappedBy: 'sport')]
private $trainees;
#[ORM\ManyToMany(targetEntity: Course::class, mappedBy: 'sports')]
private $courses;
#[ORM\OneToMany(targetEntity: Availability::class, mappedBy: 'sport')]
private $availabilities;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $status;
#[ORM\Column(type: 'integer', nullable: true)]
private $appearance;
public function __construct()
{
$this->courtInfos = new ArrayCollection();
$this->pros = new ArrayCollection();
$this->trainees = new ArrayCollection();
$this->courses = new ArrayCollection();
$this->availabilities = new ArrayCollection();
}
public function __toString()
{
return $this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getIcon()
{
return $this->icon;
}
public function setIcon($icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection|CourtInfo[]
*/
public function getCourtInfos(): Collection
{
return $this->courtInfos;
}
public function addCourtInfo(CourtInfo $courtInfo): self
{
if (!$this->courtInfos->contains($courtInfo)) {
$this->courtInfos[] = $courtInfo;
$courtInfo->setSport($this);
}
return $this;
}
public function removeCourtInfo(CourtInfo $courtInfo): self
{
if ($this->courtInfos->removeElement($courtInfo)) {
// set the owning side to null (unless already changed)
if ($courtInfo->getSport() === $this) {
$courtInfo->setSport(null);
}
}
return $this;
}
/**
* @return Collection|ProInfo[]
*/
public function getPros(): Collection
{
return $this->pros;
}
public function addPro(ProInfo $pro): self
{
if (!$this->pros->contains($pro)) {
$this->pros[] = $pro;
$pro->addSport($this);
}
return $this;
}
public function removePro(ProInfo $pro): self
{
if ($this->pros->removeElement($pro)) {
$pro->removeSport($this);
}
return $this;
}
/**
* @return Collection|SportTrainee[]
*/
public function getTrainees(): Collection
{
return $this->trainees;
}
public function addTrainee(SportTrainee $trainee): self
{
if (!$this->trainees->contains($trainee)) {
$this->trainees[] = $trainee;
$trainee->setSport($this);
}
return $this;
}
public function removeTrainee(SportTrainee $trainee): self
{
if ($this->trainees->removeElement($trainee)) {
// set the owning side to null (unless already changed)
if ($trainee->getSport() === $this) {
$trainee->setSport(null);
}
}
return $this;
}
/**
* @return Collection|Course[]
*/
public function getCourses(): Collection
{
return $this->courses;
}
public function addCourse(Course $course): self
{
if (!$this->courses->contains($course)) {
$this->courses[] = $course;
$course->addSport($this);
}
return $this;
}
public function removeCourse(Course $course): self
{
if ($this->courses->removeElement($course)) {
$course->removeSport($this);
}
return $this;
}
/**
* @return Collection|Availability[]
*/
public function getAvailabilities(): Collection
{
return $this->availabilities;
}
public function addAvailability(Availability $availability): self
{
if (!$this->availabilities->contains($availability)) {
$this->availabilities[] = $availability;
$availability->setSport($this);
}
return $this;
}
public function removeAvailability(Availability $availability): self
{
if ($this->availabilities->removeElement($availability)) {
// set the owning side to null (unless already changed)
if ($availability->getSport() === $this) {
$availability->setSport(null);
}
}
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getAppearance(): ?int
{
return $this->appearance;
}
public function setAppearance(?int $appearance): self
{
$this->appearance = $appearance;
return $this;
}
}