diff options
| author | polo <ordipolo@gmx.fr> | 2024-07-16 05:04:13 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2024-07-16 05:04:13 +0200 |
| commit | 9c9cda0ac823863c6760d77984ea2ecaf87c52ab (patch) | |
| tree | fc00fd9fbd71bf2b62bca5fe5627f2a9e816870d /src/functions.php | |
| parent | c4a3f80a6dccdff9b2abff6f159ef8fdd4382787 (diff) | |
| download | AppliGestionPHP-9c9cda0ac823863c6760d77984ea2ecaf87c52ab.tar.gz AppliGestionPHP-9c9cda0ac823863c6760d77984ea2ecaf87c52ab.tar.bz2 AppliGestionPHP-9c9cda0ac823863c6760d77984ea2ecaf87c52ab.zip | |
renommage complet des ID en id: variables, méthodes, BDD
Diffstat (limited to 'src/functions.php')
| -rw-r--r-- | src/functions.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/functions.php b/src/functions.php index e7c2e5b..47cea42 100644 --- a/src/functions.php +++ b/src/functions.php | |||
| @@ -40,7 +40,7 @@ function enterCustomer($Client): bool | |||
| 40 | unset($input); | 40 | unset($input); |
| 41 | 41 | ||
| 42 | $Client->create(); // écrire dans la base | 42 | $Client->create(); // écrire dans la base |
| 43 | $Client->setID(); // sans paramètre, exécute un $this->db->lastInsertId() | 43 | $Client->setId(); // sans paramètre, exécute un $this->db->lastInsertId() |
| 44 | 44 | ||
| 45 | return true; | 45 | return true; |
| 46 | } | 46 | } |
| @@ -76,7 +76,7 @@ function makeObjectClient() | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | echo "debug: client sélectionné\n"; | 78 | echo "debug: client sélectionné\n"; |
| 79 | $Client->setID($input); | 79 | $Client->setId($input); |
| 80 | $Client->hydrate($Client->findById()); | 80 | $Client->hydrate($Client->findById()); |
| 81 | 81 | ||
| 82 | return $Client; | 82 | return $Client; |
| @@ -100,18 +100,18 @@ function getServices(Clients $Client, string $type = '') | |||
| 100 | { | 100 | { |
| 101 | echo "debug: recherche d'une prestation\n"; | 101 | echo "debug: recherche d'une prestation\n"; |
| 102 | 102 | ||
| 103 | // on recherche les ID des prestas dans la table 'prestations' avec 'ID_client' | 103 | // on recherche les ID des prestas dans la table 'prestations' avec 'id_client' |
| 104 | $Presta = new Prestations($Client->getID()); | 104 | $Presta = new Prestations($Client->getId()); |
| 105 | $Presta->setTypePresta($type); | 105 | $Presta->setTypePresta($type); |
| 106 | $IDs = $Presta->getIDsByIdClient(); // comportement différent si le type est connu | 106 | $IDs = $Presta->getIdsByIdClient(); // comportement différent si le type est connu |
| 107 | unset($Presta); | 107 | unset($Presta); |
| 108 | 108 | ||
| 109 | // mettres toutes les données dans un tableau | 109 | // mettres toutes les données dans un tableau |
| 110 | $PrestaList = []; | 110 | $PrestaList = []; |
| 111 | foreach($IDs as $id) | 111 | foreach($IDs as $id) |
| 112 | { | 112 | { |
| 113 | $PrestaList[$id] = new Prestations($Client->getID()); // renseigne 'ID_client' | 113 | $PrestaList[$id] = new Prestations($Client->getId()); // renseigne 'id_client' |
| 114 | $PrestaList[$id]->setID($id); // ID de la prestation = clé du tableau | 114 | $PrestaList[$id]->setId($id); // ID de la prestation = clé du tableau |
| 115 | $PrestaList[$id]->hydrate($PrestaList[$id]->findById()); // données copiés de la table à l'objet | 115 | $PrestaList[$id]->hydrate($PrestaList[$id]->findById()); // données copiés de la table à l'objet |
| 116 | } | 116 | } |
| 117 | 117 | ||
| @@ -119,7 +119,7 @@ function getServices(Clients $Client, string $type = '') | |||
| 119 | $entrees = []; | 119 | $entrees = []; |
| 120 | foreach($PrestaList as $Presta) | 120 | foreach($PrestaList as $Presta) |
| 121 | { | 121 | { |
| 122 | $id = $Presta->getID(); | 122 | $id = $Presta->getId(); |
| 123 | $entrees[$id][] = $id; | 123 | $entrees[$id][] = $id; |
| 124 | $Date = new Dates((int)$Presta->getDate()); // envoi du timestamp, (int) est là par sécurité | 124 | $Date = new Dates((int)$Presta->getDate()); // envoi du timestamp, (int) est là par sécurité |
| 125 | $entrees[$id][] = $Date->getDate(); | 125 | $entrees[$id][] = $Date->getDate(); |
