summaryrefslogtreecommitdiff
path: root/src/model/Clients.php
blob: 816cff37567fd0eb88d5729d91475a0fdaac0233 (plain)
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
<?php
// model/Clients.php

class Clients extends Model
{
    // lecture des données ou hydratation
    public $ID;
    public $prenom_nom;
    public $adresse;
    public $code_client;
    public $commentaires;
	
    use ModelChildren; // renseigne parent::table
    
    //~ public function set(string $variable, $value)
    //~ {
        //~ $this->$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 $entry)
    {
        $this->hydrate(['prenom_nom' => $entry[0], 'adresse' => $entry[1], 'code_client' => $entry[2], 'commentaires' => $entry[3]]);
        $this->create();
        $this->setIdFromLastInsertID();
    }
}