From 9c9cda0ac823863c6760d77984ea2ecaf87c52ab Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 16 Jul 2024 05:04:13 +0200 Subject: =?UTF-8?q?renommage=20complet=20des=20ID=20en=20id:=20variables,?= =?UTF-8?q?=20m=C3=A9thodes,=20BDD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/Prestations.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/model/Prestations.php') diff --git a/src/model/Prestations.php b/src/model/Prestations.php index 1666018..3a415be 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php @@ -4,8 +4,8 @@ class Prestations extends Model { // lecture des données ou hydratation - protected $ID; // auto-incrémentée - protected $ID_client = 0; + protected $id; // auto-incrémentée + protected $id_client = 0; protected $code_presta = ''; protected $date = 0; // timestamp unix protected $type_presta = ''; @@ -13,24 +13,24 @@ class Prestations extends Model protected $commentaires = ''; //protected $numero_presta = 0; - public function __construct(int $ID_client) + public function __construct(int $id_client) { - $this->ID_client = $ID_client; + $this->id_client = $id_client; $this->table = strtolower(__CLASS__); // prestations } // getters - public function getID(): int + public function getId(): int { - return $this->ID; + return $this->id; } - public function getIDClient(): int + public function getIdClient(): int { - return $this->ID_client; + return $this->id_client; } - public function getIDsByIdClient() // obtenir une entrée avec son ID_client, comportement différent si le type est connu + public function getIdsByIdClient() // obtenir une entrée avec son id_client, comportement différent si le type est connu { - $sql = 'SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->ID_client; + $sql = 'SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->id_client; if($this->type_presta != '') { $sql .= " AND type_presta = '" . $this->type_presta . "'"; @@ -40,7 +40,7 @@ class Prestations extends Model $IDs = []; // si $IDs reste vide, ne pas être de type NULL for($i = 0; $i < count($data); $i++) { - $IDs[$i] = $data[$i]['ID']; // tableau simple + $IDs[$i] = $data[$i]['id']; // tableau simple } return($IDs); } @@ -92,9 +92,9 @@ class Prestations extends Model } // setters - public function setIDClient(int $value) + public function setIdClient(int $value) { - $this->ID_client = $value; + $this->id_client = $value; return $this; } //~ public function setCombientiemeFois(int $value) @@ -152,7 +152,7 @@ class Prestations extends Model { // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) // inconvénient: il peut y avoir plusieurs prestations avec le même numéro au compteur, à améliorer - $combientieme_fois = count($this->find(['ID_client' => $this->ID_client])) + 1; + $combientieme_fois = count($this->find(['id_client' => $this->id_client])) + 1; $array_code = [$Date->getYear(), $Date->getMonth(), $Date->getDay(), $code_client, $this->type_presta, $combientieme_fois]; $this->code_presta = implode('-', $array_code); -- cgit v1.2.3