src/Entity/Properties.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\HousingType;
  4. use App\Repository\PropertiesRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=PropertiesRepository::class)
  11.  */
  12. class Properties
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $roomNumber;
  24.     /**
  25.      * @ORM\Column(type="integer", nullable=true)
  26.      */
  27.     private $rent;
  28.     /**
  29.      * @ORM\Column(type="integer", nullable=true)
  30.      */
  31.     private $price;
  32.     /**
  33.      * @ORM\Column(type="boolean")
  34.      */
  35.     private $garden;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=HousingType::class, inversedBy="properties")
  38.      * @ORM\JoinColumn(nullable=false)
  39.      */
  40.     private $housingType;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      */
  44.     private $title;
  45.     /**
  46.      * @ORM\Column(type="string", length=10000)
  47.      */
  48.     private $content;
  49.     /**
  50.      * @ORM\Column(type="datetime_immutable")
  51.      */
  52.     private $createdAt;
  53.     /**
  54.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="properties", cascade={"remove"})
  55.      * @ORM\JoinColumn(nullable=false)
  56.      */
  57.     private $user;
  58. /**
  59.  * @ORM\OneToOne(targetEntity=Rental::class, mappedBy="property", cascade={"persist", "remove"}, orphanRemoval=true)
  60.  */
  61. private $rental;
  62.     /**
  63.      * @ORM\Column(type="integer")
  64.      */
  65.     private $harea;
  66.     /**
  67.      * @ORM\ManyToOne(targetEntity=Address::class, inversedBy="properties", cascade={"remove", "persist"})
  68.      * @ORM\JoinColumn(nullable=false)
  69.      */
  70.     private $address;
  71.     /**
  72.      * @ORM\Column(type="datetime")
  73.      */
  74.     private $yearBuilt;
  75.     /**
  76.      * @ORM\Column(type="string", length=255)
  77.      */
  78.     private $heating;
  79.     /**
  80.      * @ORM\OneToMany(targetEntity=Image::class, mappedBy="properties", cascade={"persist", "remove"})
  81.      */
  82.     private $images;
  83.     /**
  84.      * @ORM\ManyToOne(targetEntity=Category::class, inversedBy="properties")
  85.      * @ORM\JoinColumn(nullable=false)
  86.      */
  87.     private $category;
  88.     /**
  89.      * @ORM\ManyToMany(targetEntity=HomeInterest::class, mappedBy="properties", cascade={"remove"})
  90.      */
  91.     private $rentalInterests;
  92.     /**
  93.      * @ORM\OneToMany(targetEntity=RentalApplication::class, mappedBy="property", cascade={"remove"})
  94.      */
  95.     private $rentalApplications;
  96.     /**
  97.      * @ORM\ManyToOne(targetEntity=SubType::class, inversedBy="properties")
  98.      * @ORM\JoinColumn(nullable=true)
  99.      */
  100.     private $subType;
  101.     /**
  102.      * @ORM\Column(type="integer", nullable=true)
  103.      */
  104.     private $favoritNumber;
  105.     /**
  106.      * @ORM\OneToMany(targetEntity=Appointment::class, mappedBy="property", cascade={"remove"})
  107.      */
  108.     private $appointments;
  109.      /**
  110.      * @ORM\Column(type="boolean")
  111.      */
  112.     private $isAvailable;
  113.     public function __construct()
  114.     {
  115.         $this->appointments = new ArrayCollection();
  116.         $this->address = new Address();
  117.         $this->images = new ArrayCollection();
  118.         $this->rentalInterests = new ArrayCollection();
  119.         $this->rentalApplications = new ArrayCollection();
  120.     }
  121.     public function getId(): ?int
  122.     {
  123.         return $this->id;
  124.     }
  125.     public function getRoomNumber(): ?int
  126.     {
  127.         return $this->roomNumber;
  128.     }
  129.     public function setRoomNumber(int $roomNumber): self
  130.     {
  131.         $this->roomNumber $roomNumber;
  132.         return $this;
  133.     }
  134.     public function getRent(): ?int
  135.     {
  136.         return $this->rent;
  137.     }
  138.     public function setRent(?int $rent): self
  139.     {
  140.         $this->rent $rent;
  141.         return $this;
  142.     }
  143.     public function getPrice(): ?int
  144.     {
  145.         return $this->price;
  146.     }
  147.     public function setPrice(?int $price): self
  148.     {
  149.         $this->price $price;
  150.         return $this;
  151.     }
  152.     public function isGarden(): ?bool
  153.     {
  154.         return $this->garden;
  155.     }
  156.     public function setGarden(bool $garden): self
  157.     {
  158.         $this->garden $garden;
  159.         return $this;
  160.     }
  161.     public function getTitle(): ?string
  162.     {
  163.         return $this->title;
  164.     }
  165.     public function setTitle(string $title): self
  166.     {
  167.         $this->title $title;
  168.         return $this;
  169.     }
  170.     public function getContent(): ?string
  171.     {
  172.         return $this->content;
  173.     }
  174.     public function setContent(string $content): self
  175.     {
  176.         $this->content $content;
  177.         return $this;
  178.     }
  179.     public function getCreatedAt(): ?\DateTimeImmutable
  180.     {
  181.         return $this->createdAt;
  182.     }
  183.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  184.     {
  185.         $this->createdAt $createdAt;
  186.         return $this;
  187.     }
  188.     public function getUser(): ?User
  189.     {
  190.         return $this->user;
  191.     }
  192.     public function setUser(?User $user): self
  193.     {
  194.         $this->user $user;
  195.         return $this;
  196.     }
  197.     public function getRental(): ?Rental
  198.     {
  199.         return $this->rental;
  200.     }
  201.     public function setRental(Rental $rental): self
  202.     {
  203.         // set the owning side of the relation if necessary
  204.         if ($rental->getProperty() !== $this) {
  205.             $rental->setProperty($this);
  206.         }
  207.         $this->rental $rental;
  208.         return $this;
  209.     }
  210.     public function getHarea(): ?int
  211.     {
  212.         return $this->harea;
  213.     }
  214.     public function setHarea(int $harea): self
  215.     {
  216.         $this->harea $harea;
  217.         return $this;
  218.     }
  219.     public function getAddress(): ?Address
  220.     {
  221.         return $this->address;
  222.     }
  223.     public function setAddress(?Address $address): self
  224.     {
  225.         $this->address $address;
  226.         return $this;
  227.     }
  228.     public function getYearBuilt(): ?\DateTimeInterface
  229.     {
  230.         return $this->yearBuilt;
  231.     }
  232.     public function setYearBuilt(\DateTimeInterface $yearBuilt): self
  233.     {
  234.         $this->yearBuilt $yearBuilt;
  235.         return $this;
  236.     }
  237.     public function getHeating(): ?string
  238.     {
  239.         return $this->heating;
  240.     }
  241.     public function setHeating(string $heating): self
  242.     {
  243.         $this->heating $heating;
  244.         return $this;
  245.     }
  246.     
  247.     public function isAvailable(): ?bool
  248.     {
  249.         return $this->isAvailable;
  250.     }
  251.     public function setisAvailable (bool $isAvailable): self
  252.     {
  253.         $this->isAvailable $isAvailable;
  254.         return $this;
  255.     }
  256.     /**
  257.      * @return Collection<int, Image>
  258.      */
  259.     public function getImages(): Collection
  260.     {
  261.         return $this->images;
  262.     }
  263.     public function addImage(Image $image): self
  264.     {
  265.         if (!$this->images->contains($image)) {
  266.             $this->images[] = $image;
  267.             $image->setProperties($this);
  268.         }
  269.         return $this;
  270.     }
  271.     public function removeImage(Image $image): self
  272.     {
  273.         if ($this->images->removeElement($image)) {
  274.             // set the owning side to null (unless already changed)
  275.             if ($image->getProperties() === $this) {
  276.                 $image->setProperties(null);
  277.             }
  278.         }
  279.         return $this;
  280.     }
  281.     public function getCategory(): ?Category
  282.     {
  283.         return $this->category;
  284.     }
  285.     public function setCategory(?Category $category): self
  286.     {
  287.         $this->category $category;
  288.         return $this;
  289.     }
  290.     /**
  291.      * @return Collection<int, HomeInterest>
  292.      */
  293.     public function getHomeInterests(): Collection
  294.     {
  295.         return $this->rentalInterests;
  296.     }
  297.     public function addHomeInterest(HomeInterest $rentalInterest): self
  298.     {
  299.         if (!$this->rentalInterests->contains($rentalInterest)) {
  300.             $this->rentalInterests[] = $rentalInterest;
  301.             $rentalInterest->addProperty($this);
  302.         }
  303.         return $this;
  304.     }
  305.     public function removeHomeInterest(HomeInterest $rentalInterest): self
  306.     {
  307.         if ($this->rentalInterests->removeElement($rentalInterest)) {
  308.             $rentalInterest->removeProperty($this);
  309.         }
  310.         return $this;
  311.     }
  312.     /**
  313.      * @return Collection<int, RentalApplication>
  314.      */
  315.     public function getRentalApplications(): Collection
  316.     {
  317.         return $this->rentalApplications;
  318.     }
  319.     public function addRentalApplication(RentalApplication $rentalApplication): self
  320.     {
  321.         if (!$this->rentalApplications->contains($rentalApplication)) {
  322.             $this->rentalApplications[] = $rentalApplication;
  323.             $rentalApplication->setProperty($this);
  324.         }
  325.         return $this;
  326.     }
  327.     public function removeRentalApplication(RentalApplication $rentalApplication): self
  328.     {
  329.         if ($this->rentalApplications->removeElement($rentalApplication)) {
  330.             // set the owning side to null (unless already changed)
  331.             if ($rentalApplication->getProperty() === $this) {
  332.                 $rentalApplication->setProperty(null);
  333.             }
  334.         }
  335.         return $this;
  336.     }
  337.     /**
  338.      * @return Collection<int, HomeInterest>
  339.      */
  340.     public function getRentalInterests(): Collection
  341.     {
  342.         return $this->rentalInterests;
  343.     }
  344.     public function addRentalInterest(HomeInterest $rentalInterest): static
  345.     {
  346.         if (!$this->rentalInterests->contains($rentalInterest)) {
  347.             $this->rentalInterests->add($rentalInterest);
  348.             $rentalInterest->addProperty($this);
  349.         }
  350.         return $this;
  351.     }
  352.     public function removeRentalInterest(HomeInterest $rentalInterest): static
  353.     {
  354.         if ($this->rentalInterests->removeElement($rentalInterest)) {
  355.             $rentalInterest->removeProperty($this);
  356.         }
  357.         return $this;
  358.     }
  359.     public function getHousingType(): ?HousingType
  360. {
  361.     return $this->housingType;
  362. }
  363. public function setHousingType(?HousingType $housingType): self
  364. {
  365.     $this->housingType $housingType;
  366.     return $this;
  367. }
  368. /**
  369.  * Get the value of subType
  370.  *
  371.  * @return ?SubType
  372.  */
  373. public function getSubType(): ?SubType
  374. {
  375.     return $this->subType;
  376. }
  377. /**
  378.  * Set the value of subType
  379.  *
  380.  * @param ?SubType $subType
  381.  * @return self
  382.  */
  383. public function setSubType(?SubType $subType): self
  384. {
  385.     $this->subType $subType;
  386.     return $this;
  387. }
  388. /**
  389.  * Get the value of favoritNumber
  390.  *
  391.  * @return int|null
  392.  */
  393. public function getFavoritNumber(): ?int
  394. {
  395.     return $this->favoritNumber;
  396. }
  397. /**
  398.  * Set the value of favoritNumber
  399.  *
  400.  * @param int|null $favoritNumber
  401.  * @return self
  402.  */
  403. public function setFavoritNumber(?int $favoritNumber): self
  404. {
  405.     $this->favoritNumber $favoritNumber;
  406.     return $this;
  407. }
  408. /**
  409.      * @return Collection|Appointment[]
  410.      */
  411.     public function getAppointments(): Collection
  412.     {
  413.         return $this->appointments;
  414.     }
  415.     public function addAppointment(Appointment $appointment): self
  416.     {
  417.         if (!$this->appointments->contains($appointment)) {
  418.             $this->appointments[] = $appointment;
  419.             $appointment->setProperty($this);
  420.         }
  421.         return $this;
  422.     }
  423.     public function removeAppointment(Appointment $appointment): self
  424.     {
  425.         if ($this->appointments->removeElement($appointment)) {
  426.             // set the owning side to null (unless already changed)
  427.             if ($appointment->getProperty() === $this) {
  428.                 $appointment->setProperty(null);
  429.             }
  430.         }
  431.         return $this;
  432.     }
  433. }