From 4accca2c57b5f12169afe6a75c74efadd86d835d Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 8 Jul 2025 16:30:10 +0200 Subject: =?UTF-8?q?acc=C3=A8s=20instances=20depuis=20Prestation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/Location.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/model/entities/Location.php') diff --git a/src/model/entities/Location.php b/src/model/entities/Location.php index 7ce6f0d..b3c2f8a 100644 --- a/src/model/entities/Location.php +++ b/src/model/entities/Location.php @@ -13,9 +13,12 @@ class Location #[ORM\GeneratedValue] private int|null $id = null; - #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])] + //~ #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])] + //~ #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')] + //~ private Prestation|null $presta = null; + #[ORM\OneToOne(targetEntity: Prestation::class, inversedBy: 'location', cascade: ['persist'])] #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')] - private Prestation|null $presta = null; + private ?Prestation $presta = null; #[ORM\Column] protected string $designation; @@ -51,6 +54,14 @@ class Location { return $this->presta; } + public function getLoyer(): float + { + return $this->loyer_hebdo; + } + public function getLoyersPayes(): int + { + return $this->loyers_payes; + } public function getAll(): array { // n'utiliser get_object_vars() qu'avec une entité parce qu'on maîtrise le nombre de propriétés -- cgit v1.2.3