1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<?php
// src/model/Locations.php
class Locations extends Model
{
// lecture des données ou hydratation
protected $ID;
protected $ID_presta;
protected $designation;
protected $modele_description;
protected $valeur;
protected $etat_des_lieux_debut;
protected $etat_des_lieux_fin;
protected $duree_location;
protected $loyer_mensuel;
protected $loyers_payes;
protected $caution;
public function __construct()
{
$this->table = strtolower(__CLASS__); // locations
}
public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this)
{
return [
"Numéro location:" => $this->ID,
"Désignation:" => $this->designation,
"Description du modèle:" => $this->modele_description,
"Valeur:" => $this->valeur,
"État des lieux de début:" => $this->etat_des_lieux_debut,
"État des lieux de fin:" => $this->etat_des_lieux_fin,
"Durée de la location:" => $this->duree_location,
"Loyer Mensuel" => $this->loyer_mensuel,
"Loyers Payés" => $this->loyers_payes,
"Caution" => $this->caution];
}
// setters
public function setIDPresta(int $value)
{
$this->ID_presta = $value;
return($this);
}
public function setDesignation(string $value)
{
$this->designation = $value;
return($this);
}
public function setModeleDescription(string $value)
{
$this->modele_description = $value;
return($this);
}
public function setValeur($value)
{
$value = str_replace(',', '.', $value);
$this->valeur = (float) $value;
return($this);
}
public function setEtatDesLieuxDebut(string $value)
{
$this->etat_des_lieux_debut = $value;
return($this);
}
public function setEtatDesLieuxFin(string $value)
{
$this->etat_des_lieux_fin = $value;
return($this);
}
public function setDureeLocation(string $value)
{
$this->duree_location = $value;
return($this);
}
public function setLoyerMensuel($value)
{
$value = str_replace(',', '.', $value);
$this->loyer_mensuel = (float) $value;
return($this);
}
public function setLoyersPayes($value)
{
$value = str_replace(',', '.', $value);
$this->loyers_payes = (float) $value;
return($this);
}
public function setCaution($value)
{
$value = str_replace(',', '.', $value);
$this->caution = (float) $value;
return($this);
}
}
|