<?php
class TypeRabais {

    public static function getAll() {
        $query =  "SELECT * FROM typerabais ORDER BY NoRabais";
        $statement = Connection::getStatement($query);
        $statement->execute();
        return $statement->fetchAll();
    }
   
    public static function getTypeRabaisByNoRabais($noRabais) {
        $query = "SELECT * FROM typerabais WHERE NoRabais=:norabais";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":norabais", $noRabais);
        $statement->execute();
        return $statement->fetch();
    }

    public static function getActiveTypeRabais() {
        $query = "SELECT * FROM typerabais WHERE Actif=1 ORDER BY NoRabais";
        $statement = Connection::getStatement($query);
        $statement->execute();
        return $statement->fetchAll();
    }
}