From dedbe2f5cee33431c1299c7f0dbef4e247dc2447 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 19 Dec 2022 02:51:03 +0100 Subject: nouveau client main.php en cours --- src/model/Clients.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/model/Clients.php') diff --git a/src/model/Clients.php b/src/model/Clients.php index 1256458..816cff3 100644 --- a/src/model/Clients.php +++ b/src/model/Clients.php @@ -10,10 +10,7 @@ class Clients extends Model public $code_client; public $commentaires; - public function __construct() - { - $this->table = strtolower(__CLASS__); // simple parce que la classe a le nom de la table - } + use ModelChildren; // renseigne parent::table //~ public function set(string $variable, $value) //~ { @@ -47,4 +44,12 @@ class Clients extends Model $this->commentaires = $value; return($this); } + + + public function newRow(array $entry) + { + $this->hydrate(['prenom_nom' => $entry[0], 'adresse' => $entry[1], 'code_client' => $entry[2], 'commentaires' => $entry[3]]); + $this->create(); + $this->setIdFromLastInsertID(); + } } -- cgit v1.2.3