$variable = $value; //~ return($this); //~ } // setters public function setID(int $value) // inutile? il s'autoincrémente { $this->ID = $value; return($this); } public function setPrenom_nom(string $value) { $this->prenom_nom = $value; return($this); } public function setAdresse(string $value) { $this->adresse = $value; return($this); } public function setCode_client(string $value) { $this->code_client = $value; return($this); } public function setCommentaires(string $value) { $this->commentaires = $value; return($this); } public function newRow(array $input) { $this->hydrate(['prenom_nom' => $input[0], 'adresse' => $input[1], 'code_client' => $input[2], 'commentaires' => $input[3]]); $this->create(); $this->setIdFromLastInsertID(); // dans ModelChildren, n'utilise pas Model::execQuery() } public function findByKeywords(array $keywords, string $field): array { $result = []; for($i = 0; $i < count($keywords); $i++) { // tableau à deux dimensions obtenu pour un mot clé $query_result = $this->execQuery('SELECT * FROM ' . $this->table . ' WHERE ' . $field . ' LIKE "%' . $keywords[$i] . '%"')->fetchAll(); foreach($query_result as $one_array) // pour chaque sous tableau { $already_exist = false; for($j = 0; $j < count($result); $j++) // pour chaque tableau déjà enregistré dans le tableau $result { if($result[$j]['ID'] === $one_array['ID']) { $already_exist = true; } } if(!$already_exist) { $result[] = $one_array; } } } return($result); } }