Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace deprecated qb->execute() with executeStatement() #1706

Merged
merged 1 commit into from Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Db/AnswerMapper.php
Expand Up @@ -71,6 +71,6 @@
$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 @@
$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 @@
->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 @@
->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