summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-07-08 16:30:10 +0200
committerpolo <ordipolo@gmx.fr>2025-07-08 16:30:10 +0200
commit4accca2c57b5f12169afe6a75c74efadd86d835d (patch)
treeb0b7b821956144e5edc75471302b7624eabde3df /src/model
parent08145a5055c3f3f1d003ece3e0515da0be9a7279 (diff)
downloadAppliGestionPHP-4accca2c57b5f12169afe6a75c74efadd86d835d.zip
accès instances depuis Prestation
Diffstat (limited to 'src/model')
-rw-r--r--src/model/entities/CESU.php11
-rw-r--r--src/model/entities/Devis.php7
-rw-r--r--src/model/entities/Facture.php11
-rw-r--r--src/model/entities/Location.php15
-rw-r--r--src/model/entities/Prestation.php31
5 files changed, 67 insertions, 8 deletions
diff --git a/src/model/entities/CESU.php b/src/model/entities/CESU.php
index 09a2542..de3a359 100644
--- a/src/model/entities/CESU.php
+++ b/src/model/entities/CESU.php
@@ -13,9 +13,12 @@ class CESU
13 #[ORM\GeneratedValue] 13 #[ORM\GeneratedValue]
14 private int|null $id = null; 14 private int|null $id = null;
15 15
16 #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])] 16 //~ #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])]
17 //~ #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 //~ private Prestation|null $presta = null;
19 #[ORM\OneToOne(targetEntity: Prestation::class, inversedBy: 'cesu', cascade: ['persist'])]
17 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')] 20 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 private Prestation|null $presta = null; 21 private ?Prestation $presta = null;
19 22
20 #[ORM\Column] 23 #[ORM\Column]
21 private string $taches; 24 private string $taches;
@@ -39,6 +42,10 @@ class CESU
39 { 42 {
40 return $this->presta; 43 return $this->presta;
41 } 44 }
45 public function getSalaire(): float
46 {
47 return $this->salaire;
48 }
42 49
43 public function getAllWithWindowFields(): array 50 public function getAllWithWindowFields(): array
44 { 51 {
diff --git a/src/model/entities/Devis.php b/src/model/entities/Devis.php
index 99589e7..8518f8e 100644
--- a/src/model/entities/Devis.php
+++ b/src/model/entities/Devis.php
@@ -13,9 +13,12 @@ class Devis
13 #[ORM\GeneratedValue] 13 #[ORM\GeneratedValue]
14 private int|null $id = null; 14 private int|null $id = null;
15 15
16 #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])] 16 //~ #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])]
17 //~ #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 //~ private Prestation|null $presta = null;
19 #[ORM\OneToOne(targetEntity: Prestation::class, inversedBy: 'devis', cascade: ['persist'])]
17 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')] 20 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 private Prestation|null $presta = null; 21 private ?Prestation $presta = null;
19 22
20 #[ORM\Column] 23 #[ORM\Column]
21 private string $taches; 24 private string $taches;
diff --git a/src/model/entities/Facture.php b/src/model/entities/Facture.php
index 3a8a551..75d1a6e 100644
--- a/src/model/entities/Facture.php
+++ b/src/model/entities/Facture.php
@@ -13,9 +13,12 @@ class Facture
13 #[ORM\GeneratedValue] 13 #[ORM\GeneratedValue]
14 private int|null $id = null; 14 private int|null $id = null;
15 15
16 #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])] 16 //~ #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])]
17 //~ #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 //~ private Prestation|null $presta = null;
19 #[ORM\OneToOne(targetEntity: Prestation::class, inversedBy: 'facture', cascade: ['persist'])]
17 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')] 20 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 private Prestation|null $presta = null; 21 private ?Prestation $presta = null;
19 22
20 #[ORM\Column] 23 #[ORM\Column]
21 private string $taches; 24 private string $taches;
@@ -58,6 +61,10 @@ class Facture
58 // n'utiliser get_object_vars() qu'avec une entité parce qu'on maîtrise le nombre de propriétés 61 // n'utiliser get_object_vars() qu'avec une entité parce qu'on maîtrise le nombre de propriétés
59 return get_object_vars($this); 62 return get_object_vars($this);
60 } 63 }
64 public function getTotalMainDOeuvre(): float
65 {
66 return $this->total_main_d_oeuvre;
67 }
61 68
62 public function getAllWithWindowFields(): array 69 public function getAllWithWindowFields(): array
63 { 70 {
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
13 #[ORM\GeneratedValue] 13 #[ORM\GeneratedValue]
14 private int|null $id = null; 14 private int|null $id = null;
15 15
16 #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])] 16 //~ #[ORM\ManyToOne(targetEntity: Prestation::class, cascade: ['persist'])]
17 //~ #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 //~ private Prestation|null $presta = null;
19 #[ORM\OneToOne(targetEntity: Prestation::class, inversedBy: 'location', cascade: ['persist'])]
17 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')] 20 #[ORM\JoinColumn(name: 'id_presta', referencedColumnName: 'id')]
18 private Prestation|null $presta = null; 21 private ?Prestation $presta = null;
19 22
20 #[ORM\Column] 23 #[ORM\Column]
21 protected string $designation; 24 protected string $designation;
@@ -51,6 +54,14 @@ class Location
51 { 54 {
52 return $this->presta; 55 return $this->presta;
53 } 56 }
57 public function getLoyer(): float
58 {
59 return $this->loyer_hebdo;
60 }
61 public function getLoyersPayes(): int
62 {
63 return $this->loyers_payes;
64 }
54 public function getAll(): array 65 public function getAll(): array
55 { 66 {
56 // n'utiliser get_object_vars() qu'avec une entité parce qu'on maîtrise le nombre de propriétés 67 // n'utiliser get_object_vars() qu'avec une entité parce qu'on maîtrise le nombre de propriétés
diff --git a/src/model/entities/Prestation.php b/src/model/entities/Prestation.php
index 6d014d8..ce98911 100644
--- a/src/model/entities/Prestation.php
+++ b/src/model/entities/Prestation.php
@@ -27,6 +27,15 @@ class Prestation
27 private string $mode_paiement = ''; // non renseigné quand on fait un devis 27 private string $mode_paiement = ''; // non renseigné quand on fait un devis
28 #[ORM\Column] 28 #[ORM\Column]
29 private string $commentaires; 29 private string $commentaires;
30
31 #[ORM\OneToOne(mappedBy: 'presta', targetEntity: Facture::class)]
32 private ?facture $facture = null;
33 #[ORM\OneToOne(mappedBy: 'presta', targetEntity: Devis::class)]
34 private ?devis $devis;
35 #[ORM\OneToOne(mappedBy: 'presta', targetEntity: CESU::class)]
36 private ?cesu $cesu;
37 #[ORM\OneToOne(mappedBy: 'presta', targetEntity: Location::class)]
38 private ?location $location;
30 39
31 public static EntityManager $entityManager; 40 public static EntityManager $entityManager;
32 41
@@ -56,6 +65,10 @@ class Prestation
56 { 65 {
57 return $this->type_presta; 66 return $this->type_presta;
58 } 67 }
68 public function getModePaiement(): string
69 {
70 return $this->mode_paiement;
71 }
59 public function getClient(): Client 72 public function getClient(): Client
60 { 73 {
61 return $this->client; 74 return $this->client;
@@ -79,6 +92,24 @@ class Prestation
79 "Commentaires:" => $this->commentaires]; 92 "Commentaires:" => $this->commentaires];
80 } 93 }
81 94
95 // une interface pour ça c'est bien aussi non?
96 public function getFacture(): ?Facture
97 {
98 return $this->facture;
99 }
100 public function getDevis(): ?Devis
101 {
102 return $this->devis;
103 }
104 public function getCesu(): ?CESU
105 {
106 return $this->cesu;
107 }
108 public function getLocation(): ?Location
109 {
110 return $this->location;
111 }
112
82 // setters 113 // setters
83 //~ public function setCodePresta(string $value) 114 //~ public function setCodePresta(string $value)
84 //~ { 115 //~ {