|
|
|
@ -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(
|
|
|
|
|
':content' => array($content, PDO::PARAM_STR),
|
|
|
|
|
':question' => array($question, PDO::PARAM_STR)
|
|
|
|
|
':questionContent' => array($questionContent, PDO::PARAM_STR)
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$idResponse = $this->connection->lastInsertId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($category as $keyword){
|
|
|
|
|
$query = "INSERT INTO Categorize (response, keyword) VALUES(:response, :keyword)";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':response' => array($idResponse, PDO::PARAM_STR),
|
|
|
|
|
'keyword' => array($keyword, PDO::PARAM_STR)
|
|
|
|
|
':keyword' => array($keyword, PDO::PARAM_STR)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|