connection = (new ConnectClass)->connect(); }catch(PDOException $e){ throw new PDOException($e->getMessage(), $e->getCode(), $e); } } public function getPossibleResponseByQuestion(int $idQuestion): array { $query = "SELECT pr.* FROM Propose p, PossibleResponse pr WHERE p.question = :questionId AND p.possibleResponse = pr.id"; $this->connection->executeQuery($query, array( ':questionId' => array($idQuestion, PDO::PARAM_INT) )); return $this->connection->getResults(); } public function insertPossibleResponse(string $contentPossibleResponse): int { $query = "INSERT INTO PossibleResponse(content) VALUES(:content)"; $this->connection->executeQuery($query, array( ':content' => array($contentPossibleResponse, PDO::PARAM_STR) )); return $this->connection->lastInsertId(); } public function deletePossibleResponse(int $id): void { $query = "DELETE FROM Reference WHERE response = :id"; $this->connection->executeQuery($query, array( ':id' => array($id, PDO::PARAM_INT) )); $query = "DELETE FROM PossibleResponse WHERE id = :id"; $this->connection->executeQuery($query, array( ':id' => array($id, PDO::PARAM_INT) )); } }