src/Entity/Center.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CenterRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CenterRepository::class)
  9.  */
  10. class Center
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $country;
  26.     /**
  27.      * @ORM\OneToOne(targetEntity=Address::class, cascade={"persist", "remove"})
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $address;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Room::class, mappedBy="center")
  33.      */
  34.     private $rooms;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Reservation::class, mappedBy="center")
  37.      */
  38.     private $reservations;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=StatWeight::class, mappedBy="center")
  41.      */
  42.     private $statWeights;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=StatReservation::class, mappedBy="center")
  45.      */
  46.     private $statReservations;
  47.     /**
  48.      * @ORM\Column(type="text")
  49.      */
  50.     private $description;
  51.     public function __construct()
  52.     {
  53.         $this->rooms = new ArrayCollection();
  54.         $this->reservations = new ArrayCollection();
  55.         $this->statWeights = new ArrayCollection();
  56.         $this->statReservations = new ArrayCollection();
  57.     }
  58.     public function __toString()
  59.     {
  60.         return $this->name ;
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getName(): ?string
  67.     {
  68.         return $this->name;
  69.     }
  70.     public function setName(string $name): self
  71.     {
  72.         $this->name $name;
  73.         return $this;
  74.     }
  75.     public function getCountry(): ?string
  76.     {
  77.         return $this->country;
  78.     }
  79.     public function setCountry(string $country): self
  80.     {
  81.         $this->country $country;
  82.         return $this;
  83.     }
  84.     public function getAddress(): ?Address
  85.     {
  86.         return $this->address;
  87.     }
  88.     public function setAddress(Address $address): self
  89.     {
  90.         $this->address $address;
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return Collection<int, Room>
  95.      */
  96.     public function getRooms(): Collection
  97.     {
  98.         return $this->rooms;
  99.     }
  100.     public function addRoom(Room $room): self
  101.     {
  102.         if (!$this->rooms->contains($room)) {
  103.             $this->rooms[] = $room;
  104.             $room->setCenter($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removeRoom(Room $room): self
  109.     {
  110.         if ($this->rooms->removeElement($room)) {
  111.             // set the owning side to null (unless already changed)
  112.             if ($room->getCenter() === $this) {
  113.                 $room->setCenter(null);
  114.             }
  115.         }
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection<int, Reservation>
  120.      */
  121.     public function getReservations(): Collection
  122.     {
  123.         return $this->reservations;
  124.     }
  125.     public function addReservation(Reservation $reservation): self
  126.     {
  127.         if (!$this->reservations->contains($reservation)) {
  128.             $this->reservations[] = $reservation;
  129.             $reservation->setCenter($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeReservation(Reservation $reservation): self
  134.     {
  135.         if ($this->reservations->removeElement($reservation)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($reservation->getCenter() === $this) {
  138.                 $reservation->setCenter(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection<int, StatWeight>
  145.      */
  146.     public function getStatWeights(): Collection
  147.     {
  148.         return $this->statWeights;
  149.     }
  150.     public function addStatWeight(StatWeight $statWeight): self
  151.     {
  152.         if (!$this->statWeights->contains($statWeight)) {
  153.             $this->statWeights[] = $statWeight;
  154.             $statWeight->setCenter($this);
  155.         }
  156.         return $this;
  157.     }
  158.     public function removeStatWeight(StatWeight $statWeight): self
  159.     {
  160.         if ($this->statWeights->removeElement($statWeight)) {
  161.             // set the owning side to null (unless already changed)
  162.             if ($statWeight->getCenter() === $this) {
  163.                 $statWeight->setCenter(null);
  164.             }
  165.         }
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return Collection<int, StatReservation>
  170.      */
  171.     public function getStatReservations(): Collection
  172.     {
  173.         return $this->statReservations;
  174.     }
  175.     public function addStatReservation(StatReservation $statReservation): self
  176.     {
  177.         if (!$this->statReservations->contains($statReservation)) {
  178.             $this->statReservations[] = $statReservation;
  179.             $statReservation->setCenter($this);
  180.         }
  181.         return $this;
  182.     }
  183.     public function removeStatReservation(StatReservation $statReservation): self
  184.     {
  185.         if ($this->statReservations->removeElement($statReservation)) {
  186.             // set the owning side to null (unless already changed)
  187.             if ($statReservation->getCenter() === $this) {
  188.                 $statReservation->setCenter(null);
  189.             }
  190.         }
  191.         return $this;
  192.     }
  193.     public function getDescription(): ?string
  194.     {
  195.         return $this->description;
  196.     }
  197.     public function setDescription(string $description): self
  198.     {
  199.         $this->description $description;
  200.         return $this;
  201.     }
  202. }