From 9d6560f99e19733c7690e0f5ccdebd135e5a289a Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Fri, 1 Sep 2023 19:14:38 +0200 Subject: [PATCH] chore: replace deprecated qb->execute() with executeStatement() Signed-off-by: Christian Hartmann --- lib/Db/AnswerMapper.php | 2 +- lib/Db/QuestionMapper.php | 2 +- lib/Db/ShareMapper.php | 4 ++-- tests/Integration/Api/ApiV2Test.php | 24 ++++++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/Db/AnswerMapper.php b/lib/Db/AnswerMapper.php index 710f95818..7ab374eae 100644 --- a/lib/Db/AnswerMapper.php +++ b/lib/Db/AnswerMapper.php @@ -71,6 +71,6 @@ public function deleteBySubmission(int $submissionId): void { $qb->expr()->eq('submission_id', $qb->createNamedParameter($submissionId, IQueryBuilder::PARAM_INT)) ); - $qb->execute(); + $qb->executeStatement(); } } diff --git a/lib/Db/QuestionMapper.php b/lib/Db/QuestionMapper.php index a9d91dab9..2cb7d5958 100644 --- a/lib/Db/QuestionMapper.php +++ b/lib/Db/QuestionMapper.php @@ -89,7 +89,7 @@ public function deleteByForm(int $formId): void { $qb->expr()->eq('form_id', $qb->createNamedParameter($formId, IQueryBuilder::PARAM_INT)) ); - $qb->execute(); + $qb->executeStatement(); } public function findById(int $questionId): Question { diff --git a/lib/Db/ShareMapper.php b/lib/Db/ShareMapper.php index 8ac36f5b6..e56ae0cfd 100644 --- a/lib/Db/ShareMapper.php +++ b/lib/Db/ShareMapper.php @@ -115,7 +115,7 @@ public function deleteById(int $id): void { ->where( $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); - $qb->execute(); + $qb->executeStatement(); } /** @@ -129,6 +129,6 @@ public function deleteByForm(int $formId): void { ->where( $qb->expr()->eq('form_id', $qb->createNamedParameter($formId, IQueryBuilder::PARAM_INT)) ); - $qb->execute(); + $qb->executeStatement(); } } diff --git a/tests/Integration/Api/ApiV2Test.php b/tests/Integration/Api/ApiV2Test.php index ba38e6a2c..d9a6f9c15 100644 --- a/tests/Integration/Api/ApiV2Test.php +++ b/tests/Integration/Api/ApiV2Test.php @@ -215,7 +215,7 @@ public function setUp(): void { 'show_expiration' => $qb->createNamedParameter($form['show_expiration'], IQueryBuilder::PARAM_BOOL), 'last_updated' => $qb->createNamedParameter($form['last_updated'], IQueryBuilder::PARAM_INT), ]); - $qb->execute(); + $qb->executeStatement(); $formId = $qb->getLastInsertId(); $this->testForms[$index]['id'] = $formId; @@ -232,7 +232,7 @@ public function setUp(): void { 'description' => $qb->createNamedParameter($question['description'], IQueryBuilder::PARAM_STR), 'extra_settings_json' => $qb->createNamedParameter(json_encode($question['extraSettings']), IQueryBuilder::PARAM_STR), ]); - $qb->execute(); + $qb->executeStatement(); $questionId = $qb->getLastInsertId(); $this->testForms[$index]['questions'][$qIndex]['id'] = $questionId; @@ -243,7 +243,7 @@ public function setUp(): void { 'question_id' => $qb->createNamedParameter($questionId, IQueryBuilder::PARAM_INT), 'text' => $qb->createNamedParameter($option['text'], IQueryBuilder::PARAM_STR) ]); - $qb->execute(); + $qb->executeStatement(); $this->testForms[$index]['questions'][$qIndex]['options'][$oIndex]['id'] = $qb->getLastInsertId(); } } @@ -257,7 +257,7 @@ public function setUp(): void { 'share_with' => $qb->createNamedParameter($share['shareWith'], IQueryBuilder::PARAM_STR), 'permissions_json' => $qb->createNamedParameter(json_encode($share['permissions'] ?? null), IQueryBuilder::PARAM_STR), ]); - $qb->execute(); + $qb->executeStatement(); $this->testForms[$index]['shares'][$sIndex]['id'] = $qb->getLastInsertId(); } @@ -269,7 +269,7 @@ public function setUp(): void { 'user_id' => $qb->createNamedParameter($submission['userId'], IQueryBuilder::PARAM_STR), 'timestamp' => $qb->createNamedParameter($submission['timestamp'], IQueryBuilder::PARAM_INT) ]); - $qb->execute(); + $qb->executeStatement(); $submissionId = $qb->getLastInsertId(); $this->testForms[$index]['submissions'][$suIndex]['id'] = $submissionId; @@ -280,7 +280,7 @@ public function setUp(): void { 'question_id' => $qb->createNamedParameter($this->testForms[$index]['questions'][$answer['questionIndex']]['id'], IQueryBuilder::PARAM_INT), 'text' => $qb->createNamedParameter($answer['text'], IQueryBuilder::PARAM_STR) ]); - $qb->execute(); + $qb->executeStatement(); $this->testForms[$index]['submissions'][$suIndex]['answers'][$aIndex]['id'] = $qb->getLastInsertId(); } } @@ -304,36 +304,36 @@ public function tearDown(): void { foreach ($this->testForms as $form) { $qb->delete('forms_v2_forms') ->where($qb->expr()->eq('id', $qb->createNamedParameter($form['id'], IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); foreach ($form['questions'] as $question) { $qb->delete('forms_v2_questions') ->where($qb->expr()->eq('id', $qb->createNamedParameter($question['id'], IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); foreach ($question['options'] as $option) { $qb->delete('forms_v2_options') ->where($qb->expr()->eq('id', $qb->createNamedParameter($option['id'], IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); } } foreach ($form['shares'] as $share) { $qb->delete('forms_v2_shares') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share['id'], IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); } if (isset($form['submissions'])) { foreach ($form['submissions'] as $submission) { $qb->delete('forms_v2_submissions') ->where($qb->expr()->eq('id', $qb->createNamedParameter($submission['id'], IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); foreach ($submission['answers'] as $answer) { $qb->delete('forms_v2_answers') ->where($qb->expr()->eq('id', $qb->createNamedParameter($answer['id'], IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); } } }