Supprimer 'models/questionModel.php'

pull/17/head
Kevin MONDEJAR 6 months ago
parent 434a36c05d
commit 3c34865a6a

@ -1,65 +0,0 @@
<?php
require_once("questionEntity.php");
require_once("questionGateway.php");
class questionModel
{
private QuestionGateway $gateway;
public function __construct(QuestionGateway $gateway)
{
$this -> gateway = $gateway;
}
public function createQuestion(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer) : bool
{
$q = new QuestionEntity($id_question, $question, $answerA, $answerB, $answerC, $answerD, $cAnswer);
return $this -> gateway -> create($q);
}
public function getQuestion(int $id_question) : ?QuestionEntity
{
return $this -> gateway -> findById($id_question);
}
public function updateTextQuestion(int $id_question, string $question) : bool
{
$q = $this -> gateway -> findById($id_question);
if ($q)
{
$q -> setQuestion($question);
return $this -> gateway -> updateText($q);
}
return false;
}
public function updateAnswersQuestion(int $id_question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer) : bool
{
$q = $this -> gateway -> findById($id_question);
if ($q)
{
$q -> setAnswerA($answerA);
$q -> setAnswerB($answerB);
$q -> setAnswerC($answerC);
$q -> setAnswerD($answerD);
$q -> setAnswerC($cAnswer);
return $this -> gateway -> updateAnswers($q);
}
return false;
}
public function deleteQuestion(int $id_question) : bool
{
return $this -> gateway -> delete($id_question);
}
public function getAllQuestions() : array
{
return $this -> gateway -> findAll();
}
}
Loading…
Cancel
Save