summaryrefslogtreecommitdiff
path: root/src/model/traits.php
blob: 43d9b7ff39c8fac81a27b1c673780c6cded59350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
// model/traits.php

trait ModelChildren // pour ne pas toucher au constructeur de la classe Model
{
    public function __construct()
    {
        $this->table = strtolower(__CLASS__);
    }
    
    public function setIdFromLastInsertID() // à faire juste après l'écriture d'une nouvelle entrée
    {
        $this->db = parent::getInstance();
        $this->ID = $this->db->lastInsertId(); // méthode de PDO
    }
}