Test the merge
continuous-integration/drone/push Build is passing Details

LoginModification
Alexis 2 years ago
parent c3e28166b6
commit d44e655d8e

@ -65,8 +65,8 @@ class GatewayListResponseOfCandidate
$query = "INSERT INTO ListResponsesOfCandidate(date, titleForm) VALUES(:date, :titleForm)"; $query = "INSERT INTO ListResponsesOfCandidate(date, titleForm) VALUES(:date, :titleForm)";
$this->connection->executeQuery($query, array( $this->connection->executeQuery($query, array(
':date' => array(date('d-m-y h:i:s'), PDO::PARAM_STR), ':date' => array(date('Y-m-d H:i:s'), PDO::PARAM_STR),
'titleForm' => array($titleForm, PDO::PARAM_STR) ':titleForm' => array($titleForm, PDO::PARAM_STR)
)); ));
$idListQuestion = $this->connection->lastInsertId(); $idListQuestion = $this->connection->lastInsertId();
@ -75,7 +75,6 @@ class GatewayListResponseOfCandidate
{ {
$idResponse = $gatewayResponse->insertResponse($gatewayQuestion->getQuestionContentById($id[$i]), $answer[$i], $category[$i]); $idResponse = $gatewayResponse->insertResponse($gatewayQuestion->getQuestionContentById($id[$i]), $answer[$i], $category[$i]);
$query = "INSERT INTO Submit (responsesCandidate, response) VALUES(:responsesCandidate, :response)"; $query = "INSERT INTO Submit (responsesCandidate, response) VALUES(:responsesCandidate, :response)";
$this->connection->executeQuery($query, array( $this->connection->executeQuery($query, array(
':responsesCandidate' => array($idListQuestion, PDO::PARAM_STR), ':responsesCandidate' => array($idListQuestion, PDO::PARAM_STR),

@ -53,21 +53,22 @@ class GatewayResponse
)); ));
} }
public function insertResponse(string $content, string $question, array $category): int public function insertResponse(string $content, string $questionContent, array $category): int
{ {
$query = "INSERT INTO Response(content, question) VALUES (:content, :question)"; $query = "INSERT INTO Response(content, questionContent) VALUES (:content, :questionContent)";
$this->connection->executeQuery($query, array( $this->connection->executeQuery($query, array(
':content' => array($content, PDO::PARAM_STR), ':content' => array($content, PDO::PARAM_STR),
':question' => array($question, PDO::PARAM_STR) ':questionContent' => array($questionContent, PDO::PARAM_STR)
)); ));
$idResponse = $this->connection->lastInsertId(); $idResponse = $this->connection->lastInsertId();
foreach ($category as $keyword){ foreach ($category as $keyword){
$query = "INSERT INTO Categorize (response, keyword) VALUES(:response, :keyword)"; $query = "INSERT INTO Categorize (response, keyword) VALUES(:response, :keyword)";
$this->connection->executeQuery($query, array( $this->connection->executeQuery($query, array(
':response' => array($idResponse, PDO::PARAM_STR), ':response' => array($idResponse, PDO::PARAM_STR),
'keyword' => array($keyword, PDO::PARAM_STR) ':keyword' => array($keyword, PDO::PARAM_STR)
)); ));
} }

@ -3,9 +3,8 @@
namespace Model; namespace Model;
use API\script\Gateway\GatewayForm; use API\script\Gateway\GatewayForm;
use API\script\Gateway\GatewayListResponseOfCandidate;
use API\script\Gateway\GatewayQuestion; use API\script\Gateway\GatewayQuestion;
use API\script\Gateway\GatewayResponse;
use BusinessClass\TextQuestion;
class ModelCandidate class ModelCandidate
{ {
@ -29,14 +28,8 @@ class ModelCandidate
$category[] = $categs; $category[] = $categs;
} }
var_dump($id); $titleForm = (new GatewayForm())->getForm()[0]["title"];
echo "<br>"; (new GatewayListResponseOfCandidate())->insertListResponsesOfCandidate($id, $answer, $category, $titleForm);
var_dump($answer);
echo "<br>";
var_dump($category);
echo "<br><br>";
(new GatewayResponse())->insertResponse($id, $answer, $category);
} }
public function getForm(): string public function getForm(): string

Loading…
Cancel
Save