createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); $this->typ = ImmobilienTyp::WOHNUNG; } #[ORM\PreUpdate] public function setUpdatedAtValue(): void { $this->updatedAt = new \DateTime(); } public function getId(): ?int { return $this->id; } public function getAdresse(): string { return $this->adresse; } public function setAdresse(string $adresse): self { $this->adresse = $adresse; return $this; } public function getPreis(): float { return $this->preis; } public function setPreis(float $preis): self { $this->preis = $preis; return $this; } public function getFlaeche(): float { return $this->flaeche; } public function setFlaeche(float $flaeche): self { $this->flaeche = $flaeche; return $this; } public function getGarage(): bool { return $this->garage; } public function isGarage(): bool { return $this->garage; } public function setGarage(bool $garage): self { $this->garage = $garage; return $this; } public function getZimmer(): int { return $this->zimmer; } public function setZimmer(int $zimmer): self { $this->zimmer = $zimmer; return $this; } public function getBaujahr(): ?int { return $this->baujahr; } public function setBaujahr(?int $baujahr): self { $this->baujahr = $baujahr; return $this; } public function getTyp(): ImmobilienTyp { return $this->typ; } public function setTyp(ImmobilienTyp $typ): self { $this->typ = $typ; return $this; } public function getBeschreibung(): ?string { return $this->beschreibung; } public function setBeschreibung(?string $beschreibung): self { $this->beschreibung = $beschreibung; return $this; } public function isVerfuegbar(): bool { return $this->verfuegbar; } public function setVerfuegbar(bool $verfuegbar): self { $this->verfuegbar = $verfuegbar; return $this; } public function getBalkonFlaeche(): ?int { return $this->balkonFlaeche; } public function setBalkonFlaeche(?int $balkonFlaeche): self { $this->balkonFlaeche = $balkonFlaeche; return $this; } public function getKellerFlaeche(): ?int { return $this->kellerFlaeche; } public function setKellerFlaeche(?int $kellerFlaeche): self { $this->kellerFlaeche = $kellerFlaeche; return $this; } public function getEtage(): ?int { return $this->etage; } public function setEtage(?int $etage): self { $this->etage = $etage; return $this; } public function getHeizungstyp(): ?string { return $this->heizungstyp; } public function setHeizungstyp(?string $heizungstyp): self { $this->heizungstyp = $heizungstyp; return $this; } public function getNebenkosten(): ?float { return $this->nebenkosten; } public function setNebenkosten(?float $nebenkosten): self { $this->nebenkosten = $nebenkosten; return $this; } public function getCreatedAt(): \DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): \DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function getVerwalter(): User { return $this->verwalter; } public function setVerwalter(User $verwalter): self { $this->verwalter = $verwalter; return $this; } /** * Berechnet den Preis pro Quadratmeter */ public function getPreisProQm(): float { if ($this->flaeche > 0) { return round($this->preis / $this->flaeche, 2); } return 0; } /** * Berechnet die Gesamtfläche inkl. Balkon und Keller */ public function getGesamtflaeche(): float { $gesamt = $this->flaeche; if ($this->balkonFlaeche) { $gesamt += $this->balkonFlaeche; } if ($this->kellerFlaeche) { $gesamt += $this->kellerFlaeche; } return $gesamt; } }