From ce00453a1d033ee060252767da682da916295cb7 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 5 Feb 2016 09:18:01 +0100 Subject: [PATCH] Correction modele + comment --- automate.php | 10 +++++----- view/users.php | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/automate.php b/automate.php index fbf06de..b69448e 100755 --- a/automate.php +++ b/automate.php @@ -76,7 +76,7 @@ $requete = new manager\ModuleRequest('userDefaultModule/getAll'); $answer = $requete->dispatch(); - // var_dump( $answer->serialize() ); + var_dump( \manager\ManagerError::explicit($answer->error) ); var_dump( $answer->get('users') ); return true; @@ -100,12 +100,12 @@ // Creation de la requete $request = new \manager\ModuleRequest('firstModule/getUsers'); - + $answer = $request->dispatch(); // Debug error - var_dump( $request->error ); - var_dump( \manager\ManagerError::explicit($request->error) ); + var_dump( $answer->error ); + var_dump( \manager\ManagerError::explicit($answer->error) ); - $users = $request->dispatch()->get('users'); + $users = $answer->get('users'); diff --git a/view/users.php b/view/users.php index ff0dbf2..00c5a5c 100755 --- a/view/users.php +++ b/view/users.php @@ -56,15 +56,21 @@ // On recupere tous les utilisateurs debug(); - $request = new \manager\ModuleRequest('userDefaultModule/getAll'); - $answer = $request->dispatch(); + + $request = new \manager\ModuleRequest('userDefaultModule/getAll'); // On utilise la methode 'getAll' du module 'userDefaultModule' + $answer = $request->dispatch(); // On recupere la reponse echo '
'; echo 'Liste des utilisateurs:
'; + + // si erreur, on affiche l'explicitation if( $answer->error != \manager\ManagerError::Success ) var_dump( \manager\ManagerError::explicit($answer->error) ); + + // Si aucune erreur, on affiche les resultats else var_dump( $answer->get('users') ); + echo '
'; }