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) )); } }