|
|
@ -18,11 +18,11 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
|
|
public function insertForm(Form $form): void
|
|
|
|
public function insertForm(Form $form): void
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(empty($this->getForm())) {
|
|
|
|
if (empty($this->getForm())) {
|
|
|
|
$query = "INSERT INTO Form(title, description) VALUES(:title, :description)";
|
|
|
|
$query = "INSERT INTO Form(title, description) VALUES(:title, :desc)";
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
':title' => array($form->getTitle(), PDO::PARAM_STR),
|
|
|
|
':title' => array($form->getTitle(), PDO::PARAM_STR),
|
|
|
|
':description' => array($form->getDescription(), PDO::PARAM_STR)
|
|
|
|
':desc' => array($form->getDescription(), PDO::PARAM_STR)
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -45,7 +45,10 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
|
|
public function assignKeywordToQuestion(string $keyword, string $response, int $idQuestion): void
|
|
|
|
public function assignKeywordToQuestion(string $keyword, string $response, int $idQuestion): void
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query = "SELECT pr.id FROM Propose p, PossibleResponse pr WHERE p.question = :id AND p.possibleResponse = pr.id AND pr.content = :response";
|
|
|
|
$query = "SELECT pr.id
|
|
|
|
|
|
|
|
FROM Propose p, PossibleResponse pr
|
|
|
|
|
|
|
|
WHERE p.question = :id AND p.possibleResponse = pr.id
|
|
|
|
|
|
|
|
AND pr.content = :response";
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
':id' => array($idQuestion, PDO::PARAM_INT),
|
|
|
|
':id' => array($idQuestion, PDO::PARAM_INT),
|
|
|
|
':response' => array($response, PDO::PARAM_STR)
|
|
|
|
':response' => array($response, PDO::PARAM_STR)
|
|
|
@ -62,7 +65,9 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
|
|
public function deleteKeywordFromQuestion(string $keyword, string $response, Question $question): void
|
|
|
|
public function deleteKeywordFromQuestion(string $keyword, string $response, Question $question): void
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query = "SELECT pr.id FROM Propose p, PossibleResponse r WHERE p.question = :id AND p.possibleResponse = pr.id AND pr.content = :response";
|
|
|
|
$query = "SELECT pr.id FROM Propose p, PossibleResponse r
|
|
|
|
|
|
|
|
WHERE p.question = :id AND p.possibleResponse = pr.id
|
|
|
|
|
|
|
|
AND pr.content = :response";
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
':id' => array($question->getId(), PDO::PARAM_INT),
|
|
|
|
':id' => array($question->getId(), PDO::PARAM_INT),
|
|
|
|
':response' => array($response, PDO::PARAM_STR)
|
|
|
|
':response' => array($response, PDO::PARAM_STR)
|
|
|
@ -97,9 +102,9 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
|
|
public function deleteDescriptionToForm(Form $form): void
|
|
|
|
public function deleteDescriptionToForm(Form $form): void
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query = "UPDATE Form SET title = :title WHERE description = :description";
|
|
|
|
$query = "UPDATE Form SET title = :title WHERE description = :descript";
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
':description' => array('', PDO::PARAM_STR),
|
|
|
|
':descript' => array('', PDO::PARAM_STR),
|
|
|
|
':id' => array($form->getId(), PDO::PARAM_INT)
|
|
|
|
':id' => array($form->getId(), PDO::PARAM_INT)
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|