<?php
class VHCAction {
    public static function getByIdVHCAndIDAction($idVHC, $idAction) {
        $query = "SELECT * FROM vhc_action WHERE Id_vhc = :idvhc AND Id_action = :idaction";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":idvhc", $idVHC);
        $statement->bindParam(":idaction", $idAction);
        $statement->execute();
        return $statement->fetch();
    }

    public static function getByIdVHC($idVHC) {
        $query = "SELECT action.* FROM vhc_action, action WHERE vhc_action.Id_vhc = :idvhc AND vhc_action.Id_action = action.Id ORDER BY action.Id_Rubrique, action.Position";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":idvhc", $idVHC);
        $statement->execute();
        return $statement->fetchAll();
    }
}