Skip to content

Commit

Permalink
chore: replace deprecated qb->execute() with executeStatement()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
  • Loading branch information
Chartman123 committed Sep 1, 2023
1 parent 9ca10e1 commit 9d6560f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/Db/AnswerMapper.php
Expand Up @@ -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();

Check warning on line 74 in lib/Db/AnswerMapper.php

View check run for this annotation

Codecov / codecov/patch

lib/Db/AnswerMapper.php#L74

Added line #L74 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion lib/Db/QuestionMapper.php
Expand Up @@ -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();

Check warning on line 92 in lib/Db/QuestionMapper.php

View check run for this annotation

Codecov / codecov/patch

lib/Db/QuestionMapper.php#L92

Added line #L92 was not covered by tests
}

public function findById(int $questionId): Question {
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/ShareMapper.php
Expand Up @@ -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();

Check warning on line 118 in lib/Db/ShareMapper.php

View check run for this annotation

Codecov / codecov/patch

lib/Db/ShareMapper.php#L118

Added line #L118 was not covered by tests
}

/**
Expand All @@ -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();

Check warning on line 132 in lib/Db/ShareMapper.php

View check run for this annotation

Codecov / codecov/patch

lib/Db/ShareMapper.php#L132

Added line #L132 was not covered by tests
}
}
24 changes: 12 additions & 12 deletions tests/Integration/Api/ApiV2Test.php
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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();
}
}
Expand All @@ -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();
}

Expand All @@ -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;

Expand All @@ -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();
}
}
Expand All @@ -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();
}
}
}
Expand Down

0 comments on commit 9d6560f

Please sign in to comment.