summaryrefslogtreecommitdiff
path: root/old/model version 0.1/CESU.php
diff options
context:
space:
mode:
Diffstat (limited to 'old/model version 0.1/CESU.php')
-rw-r--r--old/model version 0.1/CESU.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/old/model version 0.1/CESU.php b/old/model version 0.1/CESU.php
new file mode 100644
index 0000000..2768b8f
--- /dev/null
+++ b/old/model version 0.1/CESU.php
@@ -0,0 +1,66 @@
1<?php
2// src/model/CESU.php
3
4class CESU extends Model
5{
6 //~ const TABLE = 'cesu';
7
8 // lecture des données ou hydratation
9 protected $id;
10 protected $id_presta;
11 protected $taches;
12 protected $duree_travail;
13 protected $salaire;
14
15 public function __construct()
16 {
17 $this->table = strtolower(__CLASS__); // cesu
18 }
19
20 public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this)
21 {
22 return [
23 "Tâche effectuée:" => $this->taches,
24 "Durée du travail:" => $this->duree_travail,
25 "Salaire:" => $this->salaire];
26 }
27 public function set(string $entry, string $input)
28 {
29 $input = $this->cleanSpecialChars($input); // possibilité que $input devienne une chaine vide
30 switch($entry)
31 {
32 case "Tâche effectuée:":
33 $this->setTaches($input);
34 break;
35 case "Durée du travail:":
36 $this->setDureeTravail($input);
37 break;
38 case "Salaire:":
39 $this->setSalaire($input);
40 break;
41 }
42 }
43
44 // setters
45 public function setIdPresta(int $value)
46 {
47 $this->id_presta = $value;
48 return($this);
49 }
50 public function setTaches(string $value)
51 {
52 $this->taches = $value;
53 return($this);
54 }
55 public function setDureeTravail(string $value)
56 {
57 $this->duree_travail = $value;
58 return($this);
59 }
60 public function setSalaire($value)
61 {
62 $value = str_replace(',', '.', $value);
63 $this->salaire = (float) $value;
64 return($this);
65 }
66}