src/Entity/Club.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\User;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Repository\ClubRepository;
  8. #[ORM\Entity(repositoryClassClubRepository::class)]
  9. class Club extends User
  10. {
  11.     #[ORM\OneToOne(targetEntityClubInfo::class, mappedBy'owner'cascade: ['persist''remove'])]
  12.     private $clubInfo;
  13.     #[ORM\OneToMany(targetEntityCoachInfo::class, mappedBy'createdByClub')]
  14.     private Collection $createdCoachInfos;
  15.     #[ORM\OneToMany(targetEntityAvailability::class, mappedBy'club')]
  16.     private $availabilities;
  17.     #[ORM\OneToMany(targetEntityPartnership::class, mappedBy'club')]
  18.     private $partnerships;
  19.     public function __construct()
  20.     {
  21.         parent::__construct();
  22.         $this->createdCoachInfos = new ArrayCollection();
  23.         $this->availabilities = new ArrayCollection();
  24.         $this->partnerships = new ArrayCollection();
  25.     }
  26.     public function getClubInfo(): ?ClubInfo
  27.     {
  28.         return $this->clubInfo;
  29.     }
  30.     public function setClubInfo(?ClubInfo $clubInfo): self
  31.     {
  32.         $this->clubInfo $clubInfo;
  33.         return $this;
  34.     }
  35.     public function getCreatedCoachInfos(): Collection
  36.     {
  37.         return $this->createdCoachInfos;
  38.     }
  39.     public function addCreatedCoachInfo(CoachInfo $coachInfo): self
  40.     {
  41.         if (!$this->createdCoachInfos->contains($coachInfo)) {
  42.             $this->createdCoachInfos[] = $coachInfo;
  43.             $coachInfo->setCreatedByClub($this);
  44.         }
  45.         return $this;
  46.     }
  47.     public function removeCreatedCoachInfo(CoachInfo $coachInfo): self
  48.     {
  49.         if ($this->createdCoachInfos->removeElement($coachInfo)) {
  50.             if ($coachInfo->getCreatedByClub() === $this) {
  51.                 $coachInfo->setCreatedByClub(null);
  52.             }
  53.         }
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return Collection|Availability[]
  58.      */
  59.     public function getAvailabilities(): Collection
  60.     {
  61.         return $this->availabilities;
  62.     }
  63.     public function addAvailability(Availability $availability): self
  64.     {
  65.         if (!$this->availabilities->contains($availability)) {
  66.             $this->availabilities[] = $availability;
  67.             $availability->setClub($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeAvailability(Availability $availability): self
  72.     {
  73.         if ($this->availabilities->removeElement($availability)) {
  74.             // set the owning side to null (unless already changed)
  75.             if ($availability->getClub() === $this) {
  76.                 $availability->setClub(null);
  77.             }
  78.         }
  79.         return $this;
  80.     }
  81.     /**
  82.      * @return Collection|Partnership[]
  83.      */
  84.     public function getPartnerships(): Collection
  85.     {
  86.         return $this->partnerships;
  87.     }
  88.     public function addPartnership(Partnership $partnership): self
  89.     {
  90.         if (!$this->partnerships->contains($partnership)) {
  91.             $this->partnerships[] = $partnership;
  92.             $partnership->setClub($this);
  93.         }
  94.         return $this;
  95.     }
  96.     public function removePartnership(Partnership $partnership): self
  97.     {
  98.         if ($this->partnerships->removeElement($partnership)) {
  99.             // set the owning side to null (unless already changed)
  100.             if ($partnership->getClub() === $this) {
  101.                 $partnership->setClub(null);
  102.             }
  103.         }
  104.         return $this;
  105.     }
  106. }