From 7c1b06df682dd1d9180d1bcd21f6eafd645d0e26 Mon Sep 17 00:00:00 2001
From: dydy <dydy.gregoire88120@gmail.com>
Date: Tue, 10 Mar 2020 17:02:46 +0100
Subject: [PATCH] =?UTF-8?q?R=C3=A9ctification=20du=20TD1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 php/index.php           | 21 +++++++++++----------
 php/src/question/Q1.php |  4 ++++
 php/src/question/Q2.php |  4 ++++
 php/src/question/Q3.php |  4 ++++
 php/src/question/Q4.php |  4 ++++
 php/src/question/Q5.php |  8 ++++++++
 6 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/php/index.php b/php/index.php
index 8ff452b..6985094 100644
--- a/php/index.php
+++ b/php/index.php
@@ -3,21 +3,22 @@ require_once __DIR__ . '/vendor/autoload.php';
 
 use Illuminate\Database\Capsule\Manager as DB;
 use Slim\Slim;
+use bddApp\question;
 
 $db = new DB();
 $db->addConnection(parse_ini_file('conf.ini'));
 $db->setAsGlobal();
 $db->bootEloquent();
 
-
 $app = new Slim();
-/*
-$app = new \Slim\Slim;
-
-$app->get('/', function(){
-    $c=new ControllerPlanning();
-    $c->getCycle(1);
-})->name('home');
 
-$app->run();
-*/
\ No newline at end of file
+print "Question 1 : Jeu dont le nom contient 'Mario'";
+$question1 = new question\Q1();
+print 'Question 2 : Compagnies installé au Japon';
+$question2 = new question\Q2();
+print 'Question 3 : Liste des plateformes dont la base installée est >= 10 000 000';
+$question3 = new question\Q3();
+print 'Question 4 : Liste de 442 jeux à partir du 21173ème';
+$question4 = new question\Q4();
+print 'Question 5 : Liste des jeux (nom et deck) en paginant (taille des pages : 500)';
+$question5 = new question\Q5();
diff --git a/php/src/question/Q1.php b/php/src/question/Q1.php
index 4881ca2..0d7f1cd 100644
--- a/php/src/question/Q1.php
+++ b/php/src/question/Q1.php
@@ -10,6 +10,10 @@ class Q1 {
 
         // Jeu dont le nom contient 'Mario'
         $jeuMario = Game::where('name', 'LIKE', '%mario%')->get();
+
+        foreach ($jeuMario as $jM) {
+            print '<br>'.$jM->name.'<br>';
+        }
     }
 
 }
diff --git a/php/src/question/Q2.php b/php/src/question/Q2.php
index ee17bda..6360c30 100644
--- a/php/src/question/Q2.php
+++ b/php/src/question/Q2.php
@@ -10,6 +10,10 @@ class Q2 {
 
         // Compagnies installé au Japon
         $compagniesJapon = Company::where('location_country', '=', 'Japan')->get(); 
+
+        foreach ($compagniesJapon as $cJ) {
+            print '<br>'.$cJ->name.'<br>'.'    '.$cJ->location_country.'<br>';
+        }
     }
 
 }
diff --git a/php/src/question/Q3.php b/php/src/question/Q3.php
index 93f64ac..79e9618 100644
--- a/php/src/question/Q3.php
+++ b/php/src/question/Q3.php
@@ -10,6 +10,10 @@ class Q3 {
 
         // Liste des plateformes dont la base installée est >= 10 000 000
         $lPlatform = Platform::where('install_base', '>=', '10000000')->get();
+
+        foreach ($lPlatform as $lP) {
+            print '<br>'.$lP->name.'<br>'.'    '.$lP->install_base.'<br>';
+        }
     }
 
 }
diff --git a/php/src/question/Q4.php b/php/src/question/Q4.php
index f9d2e9e..673de00 100644
--- a/php/src/question/Q4.php
+++ b/php/src/question/Q4.php
@@ -10,6 +10,10 @@ class Q4 {
 
         // Liste de 442 jeux à partir du 21173ème
         $jeux442 = Game::where('id', '>=', '21173')->take(442)->get();
+
+        foreach ($jeux442 as $j442) {
+            print '<br>'.$j442->name.'<br>';
+        }
     }
 
 }
diff --git a/php/src/question/Q5.php b/php/src/question/Q5.php
index ebb4b88..9107eca 100644
--- a/php/src/question/Q5.php
+++ b/php/src/question/Q5.php
@@ -17,10 +17,18 @@ class Q5 {
         }
 
         $page = 0;
+        print '<br>Page 1 : <br>';
         foreach($nbPage as $np) {
+
             $jeuPage = Game::where('id', '>', $nbPage[$page])->take(500)->get();
+            foreach ($jeuPage as $jP) {
+                print '<br>'.$jP->name.'<br>'.'    '.$jP->deck.'<br>';
+            }
             $page++;
+            print '<hr><br>Page '. $page.' : <br>';
         }
+
+       
     }
 
 }
-- 
GitLab