public function caricaIscritti(Appello $appello)
 {
     $query = "select \n            studenti.id studenti_id,\n            studenti.nome studenti_nome,\n            studenti.cognome studenti_cognome,\n            studenti.matricola studenti_matricola,\n            studenti.email studenti_email,\n            studenti.citta studenti_citta,\n            studenti.via studenti_via,\n            studenti.cap studenti_cap,\n            studenti.provincia studenti_provincia, \n            studenti.numero_civico studenti_numero_civico,\n            studenti.username studenti_username,\n            studenti.password studenti_password,\n            \n            CdL.id CdL_id,\n            CdL.nome CdL_nome,\n            CdL.codice CdL_codice,\n            \n            dipartimenti.id dipartimenti_id,\n            dipartimenti.nome dipartimenti_nome\n            \n            from appelli_studenti\n            join studenti on studenti.id = appelli_studenti.studente_id\n            join CdL on studenti.cdl_id = CdL.id\n            join dipartimenti on CdL.dipartimento_id = dipartimenti.id\n            where appelli_studenti.appello_id = ?";
     $mysqli = Db::getInstance()->connectDb();
     if (!isset($mysqli)) {
         error_log("[cercaStudentePerMatricola] impossibile inizializzare il database");
         $mysqli->close();
         return null;
     }
     $stmt = $mysqli->stmt_init();
     $stmt->prepare($query);
     if (!$stmt) {
         error_log("[caricaIscritti] impossibile" . " inizializzare il prepared statement");
         $mysqli->close();
         return null;
     }
     if (!$stmt->bind_param('i', $appello->getId())) {
         error_log("[caricaIscritti] impossibile" . " effettuare il binding in input");
         $mysqli->close();
         return null;
     }
     if (!$stmt->execute()) {
         error_log("[caricaIscritti] impossibile" . " eseguire lo statement");
         $mysqli->close();
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['studenti_id'], $row['studenti_nome'], $row['studenti_cognome'], $row['studenti_matricola'], $row['studenti_email'], $row['studenti_citta'], $row['studenti_via'], $row['studenti_cap'], $row['studenti_provincia'], $row['studenti_numero_civico'], $row['studenti_username'], $row['studenti_password'], $row['CdL_id'], $row['CdL_nome'], $row['CdL_codice'], $row['dipartimenti_id'], $row['dipartimenti_nome']);
     if (!$bind) {
         error_log("[caricaIscritti] impossibile" . " effettuare il binding in output");
         $mysqli->close();
         return null;
     }
     while ($stmt->fetch()) {
         $appello->iscrivi(UserFactory::instance()->creaStudenteDaArray($row));
     }
     $mysqli->close();
     $stmt->close();
 }