<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);

echo "<h3>DEBUG CONTROLLER</h3>";

$path = __DIR__ . "/DashboardController.php";
echo "Chemin: $path<br>";

if (!file_exists($path)) {
    echo "<b>ERREUR :</b> DashboardController.php introuvable !";
    exit;
}

echo "Fichier trouvé. Inclusion...<br>";

require_once $path;

echo "Inclus OK.<br>";

if (!class_exists("DashboardController")) {
    echo "<b>ERREUR :</b> Classe DashboardController non trouvée !";
    exit;
}

echo "Classe trouvée !<br>";

try {
    $c = new DashboardController();
    echo "Instance OK !<br>";
} catch (Throwable $e) {
    echo "<b>ERREUR CONSTRUCTEUR :</b><br>" . $e->getMessage();
    exit;
}

echo "<b>APPEL MÉTHODE :</b><br>";

try {
    $c->getDashboard(5); // test sur un membre
} catch (Throwable $e) {
    echo "<b>ERREUR :</b><br>" . $e->getMessage();
}
