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 '
'; }