summaryrefslogtreecommitdiff
path: root/src/model/entities/Prestation.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/entities/Prestation.php')
-rw-r--r--src/model/entities/Prestation.php25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/model/entities/Prestation.php b/src/model/entities/Prestation.php
index ee9b3c0..e7abd8b 100644
--- a/src/model/entities/Prestation.php
+++ b/src/model/entities/Prestation.php
@@ -15,7 +15,7 @@ class Prestation
15 15
16 #[ORM\ManyToOne(targetEntity: Client::class, cascade: ['persist'])] 16 #[ORM\ManyToOne(targetEntity: Client::class, cascade: ['persist'])]
17 #[ORM\JoinColumn(name: 'id_client', referencedColumnName: 'id')] 17 #[ORM\JoinColumn(name: 'id_client', referencedColumnName: 'id')]
18 private Client|null $client = null; // type int en SQL et dans la base 18 private ?Client $client = null; // type int en SQL et dans la base
19 19
20 #[ORM\Column] 20 #[ORM\Column]
21 private string $code_presta; 21 private string $code_presta;
@@ -40,12 +40,8 @@ class Prestation
40 public static EntityManager $entityManager; 40 public static EntityManager $entityManager;
41 41
42 42
43 public function __construct(?Client $client = null) 43 public function __construct(?Client $client = null){
44 { 44 $this->setClient($client);
45 if($client != null)
46 {
47 $this->setClient($client);
48 }
49 } 45 }
50 46
51 // getters 47 // getters
@@ -94,8 +90,8 @@ class Prestation
94 90
95 // une interface pour ça c'est bien aussi non? 91 // une interface pour ça c'est bien aussi non?
96 public function getFacture(): ?Facture 92 public function getFacture(): ?Facture
97 { 93 {
98 return $this->facture; 94 return $this->facture;
99 } 95 }
100 public function getDevis(): ?Devis 96 public function getDevis(): ?Devis
101 { 97 {
@@ -162,14 +158,13 @@ class Prestation
162 //$input->typeToClient(); // on modifie $client ici (merci les références PHP) 158 //$input->typeToClient(); // on modifie $client ici (merci les références PHP)
163 } 159 }
164 160
165 public function set(string $entry, $input) // $input = chaîne ou entier 161 public function set(string $entry, string|Dates $input): void
166 { 162 {
167 if(gettype($input) === 'string') 163 if(gettype($input) === 'string'){
168 { 164 $input = $this->cleanSpecialChars($input); // possibilité que $input devienne une chaine vide
169 $input = $this->cleanSpecialChars($input); // possibilité que $input devienne une chaine vide
170 } 165 }
171 switch($entry) 166
172 { 167 switch($entry){
173 // pas de cas "code presta" qui généré par setCodePresta, on peut modifier la date (ici) et le code client (ailleurs) 168 // pas de cas "code presta" qui généré par setCodePresta, on peut modifier la date (ici) et le code client (ailleurs)
174 //~ case "Numéro prestation:": 169 //~ case "Numéro prestation:":
175 //~ $this->setNumeroPresta($input); 170 //~ $this->setNumeroPresta($input);