src/Entity/ClubInfo.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ClubInfoRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassClubInfoRepository::class)]
  8. class ClubInfo
  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'boolean'nullabletrue)]
  17.     private $swimmingpool;
  18.     #[ORM\Column(type'boolean'nullabletrue)]
  19.     private $gym;
  20.     #[ORM\Column(type'boolean'nullabletrue)]
  21.     private $restaurant;
  22.     #[ORM\Column(type'boolean'nullabletrue)]
  23.     private $bar;
  24.     #[ORM\Column(type'boolean'nullabletrue)]
  25.     private $seminarRoom;
  26.     #[ORM\Column(type'boolean'nullabletrue)]
  27.     private $insurance;
  28.     #[ORM\OneToOne(targetEntityClub::class, inversedBy'clubInfo'cascade: ['persist'], fetch"EAGER")]
  29.     private $owner;
  30.     #[ORM\OneToMany(targetEntityCourtInfo::class, mappedBy'clubInfo'cascade: ['persist''remove'])]
  31.     private $courtInfos;
  32.     #[ORM\OneToMany(targetEntityCourse::class, mappedBy'club')]
  33.     private $courses;
  34.     #[ORM\Column(type'text'nullabletrue)]
  35.     private $description;
  36.     #[ORM\OneToOne(targetEntityAddress::class, cascade: ['persist''remove'])]
  37.     private $address;
  38.     #[ORM\Column(type'datetime_immutable'nullabletrueoptions: ['default' => 'CURRENT_TIMESTAMP'])]
  39.     private $createdAt;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $image null;
  42.     #[ORM\ManyToOne(targetEntityCoach::class, inversedBy'createdClubInfos')]
  43.     #[ORM\JoinColumn(nullabletrue)]
  44.     private ?Coach $createdByCoach null;
  45.     #[ORM\ManyToOne(targetEntityOperator::class, inversedBy'createdClubInfos')]
  46.     #[ORM\JoinColumn(nullabletrue)]
  47.     private ?Operator $createdByOperator null;
  48.     public function __construct()
  49.     {
  50.         $this->courtInfos = new ArrayCollection();
  51.         $this->courses = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getName(): ?string
  58.     {
  59.         return $this->name;
  60.     }
  61.     public function setName(string $name): self
  62.     {
  63.         $this->name $name;
  64.         return $this;
  65.     }
  66.     public function getSwimmingpool(): ?bool
  67.     {
  68.         return $this->swimmingpool;
  69.     }
  70.     public function setSwimmingpool(bool $swimmingpool): self
  71.     {
  72.         $this->swimmingpool $swimmingpool;
  73.         return $this;
  74.     }
  75.     public function getGym(): ?bool
  76.     {
  77.         return $this->gym;
  78.     }
  79.     public function setGym(bool $gym): self
  80.     {
  81.         $this->gym $gym;
  82.         return $this;
  83.     }
  84.     public function getRestaurant(): ?bool
  85.     {
  86.         return $this->restaurant;
  87.     }
  88.     public function setRestaurant(bool $restaurant): self
  89.     {
  90.         $this->restaurant $restaurant;
  91.         return $this;
  92.     }
  93.     public function getBar(): ?bool
  94.     {
  95.         return $this->bar;
  96.     }
  97.     public function setBar(bool $bar): self
  98.     {
  99.         $this->bar $bar;
  100.         return $this;
  101.     }
  102.     public function getSeminarRoom(): ?bool
  103.     {
  104.         return $this->seminarRoom;
  105.     }
  106.     public function setSeminarRoom(bool $seminarRoom): self
  107.     {
  108.         $this->seminarRoom $seminarRoom;
  109.         return $this;
  110.     }
  111.     public function getInsurance(): ?bool
  112.     {
  113.         return $this->insurance;
  114.     }
  115.     public function setInsurance(bool $insurance): self
  116.     {
  117.         $this->insurance $insurance;
  118.         return $this;
  119.     }
  120.     public function getOwner(): ?Club
  121.     {
  122.         return $this->owner;
  123.     }
  124.     public function setOwner(?Club $owner): self
  125.     {
  126.         // unset the owning side of the relation if necessary
  127.         if ($owner === null && $this->owner !== null) {
  128.             $this->owner->setClubInfo(null);
  129.         }
  130.         // set the owning side of the relation if necessary
  131.         if ($owner !== null && $owner->getClubInfo() !== $this) {
  132.             $owner->setClubInfo($this);
  133.         }
  134.         $this->owner $owner;
  135.         return $this;
  136.     }
  137.     /**
  138.      * @return Collection|CourtInfo[]
  139.      */
  140.     public function getCourtInfos(): Collection
  141.     {
  142.         return $this->courtInfos;
  143.     }
  144.     public function addCourtInfo(CourtInfo $courtInfo): self
  145.     {
  146.         if (!$this->courtInfos->contains($courtInfo)) {
  147.             $this->courtInfos[] = $courtInfo;
  148.             $courtInfo->setClubInfo($this);
  149.         }
  150.         return $this;
  151.     }
  152.     public function removeCourtInfo(CourtInfo $courtInfo): self
  153.     {
  154.         if ($this->courtInfos->removeElement($courtInfo)) {
  155.             // set the owning side to null (unless already changed)
  156.             if ($courtInfo->getClubInfo() === $this) {
  157.                 $courtInfo->setClubInfo(null);
  158.             }
  159.         }
  160.         return $this;
  161.     }
  162.     /**
  163.      * @return Collection|Course[]
  164.      */
  165.     public function getCourses(): Collection
  166.     {
  167.         return $this->courses;
  168.     }
  169.     public function addCourse(Course $course): self
  170.     {
  171.         if (!$this->courses->contains($course)) {
  172.             $this->courses[] = $course;
  173.             $course->setClub($this);
  174.         }
  175.         return $this;
  176.     }
  177.     public function removeCourse(Course $course): self
  178.     {
  179.         if ($this->courses->removeElement($course)) {
  180.             // set the owning side to null (unless already changed)
  181.             if ($course->getClub() === $this) {
  182.                 $course->setClub(null);
  183.             }
  184.         }
  185.         return $this;
  186.     }
  187.     public function getDescription(): ?string
  188.     {
  189.         return $this->description;
  190.     }
  191.     public function setDescription(?string $description): self
  192.     {
  193.         $this->description $description;
  194.         return $this;
  195.     }
  196.     public function getAddress(): ?Address
  197.     {
  198.         return $this->address;
  199.     }
  200.     public function setAddress(?Address $address): self
  201.     {
  202.         $this->address $address;
  203.         return $this;
  204.     }
  205.     public function hasCourtInfo()
  206.     {
  207.         $exist false;
  208.         /** @var CourtInfo $court */
  209.         foreach ($this->courtInfos as $court)
  210.         {
  211.             if ($court->getNbCovered() != null || $court->getNbCovered() != 0)
  212.             {
  213.                 $exist true;
  214.             }
  215.             if ($court->getNbSemiOpen() != null || $court->getNbSemiOpen() != 0)
  216.             {
  217.                 $exist true;
  218.             }
  219.             if ($court->getNbOpen() != null || $court->getNbOpen() != 0)
  220.             {
  221.                 $exist true;
  222.             }
  223.         }
  224.         return $exist;
  225.     }
  226.     public function getCreatedAt(): ?\DateTimeImmutable
  227.     {
  228.         return $this->createdAt;
  229.     }
  230.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  231.     {
  232.         $this->createdAt $createdAt;
  233.         return $this;
  234.     }
  235.     public function getImage(): ?string
  236.     {
  237.         return $this->image;
  238.     }
  239.     public function setImage(?string $image): static
  240.     {
  241.         $this->image $image;
  242.         return $this;
  243.     }
  244.     public function getCreatedByCoach(): ?Coach
  245.     {
  246.         return $this->createdByCoach;
  247.     }
  248.     public function setCreatedByCoach(?Coach $createdByCoach): self
  249.     {
  250.         $this->createdByCoach $createdByCoach;
  251.         return $this;
  252.     }
  253.     public function getCreatedByOperator(): ?Operator
  254.     {
  255.         return $this->createdByOperator;
  256.     }
  257.     public function setCreatedByOperator(?Operator $createdByOperator): self
  258.     {
  259.         $this->createdByOperator $createdByOperator;
  260.         return $this;
  261.     }
  262. }