diff options
Diffstat (limited to 'src/model/entities/Devis.php')
| -rw-r--r-- | src/model/entities/Devis.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/model/entities/Devis.php b/src/model/entities/Devis.php index ce2a043..70a3cbf 100644 --- a/src/model/entities/Devis.php +++ b/src/model/entities/Devis.php | |||
| @@ -38,15 +38,13 @@ class Devis | |||
| 38 | private string $delai_livraison; | 38 | private string $delai_livraison; |
| 39 | #[ORM\Column] | 39 | #[ORM\Column] |
| 40 | private string $validite_devis; | 40 | private string $validite_devis; |
| 41 | #[ORM\Column (options: ['default' => 'non'])] | 41 | #[ORM\Column (options: ['default' => 'non'])] // défaut dans le cas d'un requête SQL ignorant ce champ |
| 42 | private string $signature_devis = 'non'; | 42 | private string $signature_devis = 'non'; |
| 43 | 43 | ||
| 44 | public static EntityManager $entityManager; | 44 | public static EntityManager $entityManager; |
| 45 | 45 | ||
| 46 | public function __construct(?Prestation $presta = null){ | 46 | public function __construct(?Prestation $presta = null){ |
| 47 | if($presta != null){ | 47 | $this->setPresta($presta); |
| 48 | $this->setPresta($presta); | ||
| 49 | } | ||
| 50 | } | 48 | } |
| 51 | 49 | ||
| 52 | // getters | 50 | // getters |
| @@ -207,17 +205,16 @@ class Devis | |||
| 207 | return str_replace($search, '', $data); | 205 | return str_replace($search, '', $data); |
| 208 | } | 206 | } |
| 209 | // à mettre plus tard dans une classe mère | 207 | // à mettre plus tard dans une classe mère |
| 210 | public function hydrate(string $answers) | 208 | public function hydrate(string $answers): void |
| 211 | { | 209 | { |
| 212 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide | 210 | $answers = $this->cleanSpecialChars($answers); // possibilité que $answers devienne une chaine vide |
| 213 | if($answers == '') | 211 | if($answers == '') |
| 214 | { | 212 | { |
| 215 | echo "erreur de Devis::hydrate(), la chaine \$answers est vide.\n"; | 213 | echo "erreur de Devis::hydrate(), la chaine \$answers est vide.\n"; |
| 216 | return false; | 214 | return; |
| 217 | } | 215 | } |
| 218 | $data_array = explode('|', $answers); // array | 216 | $data_array = explode('|', $answers); // array |
| 219 | 217 | ||
| 220 | //$check = false; | ||
| 221 | if(count($data_array) === 9) // facture normale, "=== 9" = merdique | 218 | if(count($data_array) === 9) // facture normale, "=== 9" = merdique |
| 222 | { | 219 | { |
| 223 | $this->getPresta()->setModePaiement(''); // sécurité, doctrine plante si "null" | 220 | $this->getPresta()->setModePaiement(''); // sécurité, doctrine plante si "null" |
| @@ -226,7 +223,7 @@ class Devis | |||
| 226 | else | 223 | else |
| 227 | { | 224 | { |
| 228 | echo "erreur de Devis::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; | 225 | echo "erreur de Devis::hydrate(), le tableau \$data_array n'a pas la taille attendue.\n"; |
| 229 | return false; | 226 | return; |
| 230 | } | 227 | } |
| 231 | 228 | ||
| 232 | //self::$entityManager->persist('Prestation'); | 229 | //self::$entityManager->persist('Prestation'); |
