diff --git a/Source/API/script/Gateway/GatewayQuestion.php b/Source/API/script/Gateway/GatewayQuestion.php index 6c2866d..ecd22d4 100644 --- a/Source/API/script/Gateway/GatewayQuestion.php +++ b/Source/API/script/Gateway/GatewayQuestion.php @@ -30,10 +30,10 @@ class GatewayQuestion $idQuestion = $this->connection->lastInsertId(); - if(get_class($question) != TextQuestion::class){ + if (get_class($question) != TextQuestion::class) { $listPossibleResponse = $question->getPossibleResponses(); - for($i = 0; $i < count($listPossibleResponse); $i++){ + for ($i = 0; $i < count($listPossibleResponse); $i++) { $idPossibleResponse = $gatewayPossibleResponse->insertPossibleResponse($listPossibleResponse[$i]); @@ -55,14 +55,14 @@ class GatewayQuestion public function deleteQuestion(Question $question): void { - if(get_class($question) == BoxQuestion::class) { + if (get_class($question) == BoxQuestion::class) { $query = "DELETE FROM Propose WHERE question = :id"; $this->connection->executeQuery($query, array( ':id' => array($question->getId(), PDO::PARAM_INT) )); $listPossibleResponse = $question->getPossibleResponses(); - for ($i = 0; $i < count($listPossibleResponse); $i++){ + for ($i = 0; $i < count($listPossibleResponse); $i++) { $query = "DELETE FROM Reference WHERE response = :id"; $this->connection->executeQuery($query, array( ':id' => array($listPossibleResponse[$i]->getId(), PDO::PARAM_INT) @@ -83,20 +83,20 @@ class GatewayQuestion public function updateQuestion(Question $question): void { - $query = "UPDATE Question SET content = :content, type = :type, form = :form WHERE id = :id"; + $query = "UPDATE Question SET content = :content, type = :type, form = :frm WHERE id = :id"; $this->connection->executeQuery($query, array( ':content' => array($question->getContent(), PDO::PARAM_STR), ':type' => array(get_class($question), PDO::PARAM_STR), - ':form' => array($question->getForm(), PDO::PARAM_STR), + ':frm' => array($question->getForm(), PDO::PARAM_STR), ':id' => array($question->getId(), PDO::PARAM_STR) )); } - public function getAllQuestions(string $idForm): array //renvoie un array contenant trois qui pour chaque indice commun de ces 3 array une question, sa liste de reponse possible et sa liste de keyword associer au réponse. les deux autres sont null si c'est une textBox + public function getAllQuestions(string $idForm): array { - $query = "SELECT * FROM Question WHERE form = :form"; + $query = "SELECT * FROM Question WHERE form = :fom"; $this->connection->executeQuery($query, array( - ':form' => array($idForm, PDO::PARAM_INT) + ':fom' => array($idForm, PDO::PARAM_INT) )); $listQuestions = $this->connection->getResults(); @@ -105,7 +105,7 @@ class GatewayQuestion $gatewayKeyword = new GatewayKeyword(); $gatewayPossibleResponse = new GatewayPossibleResponse(); - if(!empty($listQuestions)) { + if (!empty($listQuestions)) { for ($i = 0; $i < count($listQuestions); $i++) { @@ -114,7 +114,7 @@ class GatewayQuestion $tmpTabKeyword = []; $tmpTabPossibleResponse = []; - foreach ($possibleResponses as $row){ + foreach ($possibleResponses as $row) { $tmpTabKeyword[] = $gatewayKeyword->getKeywordsContentByReference($row["id"]); $tmpTabPossibleResponse[] = $row["content"]; @@ -122,7 +122,7 @@ class GatewayQuestion $possibleResponsesContent[] = $tmpTabPossibleResponse; $keywordsResponses[] = $tmpTabKeyword; } - else{ + else { $possibleResponsesContent[] = null; $keywordsResponses[] = null; } @@ -141,4 +141,4 @@ class GatewayQuestion return $this->connection->getResults()[0][0]; } -} \ No newline at end of file +}