Skip to content

Fixes #18357 - SQL error when table prefix used. #18412

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2018

Conversation

pocallaghan
Copy link
Contributor

Description

Hard-coded table names cause errors if a table prefix, passing the table name to getTable resolves this.

Fixed Issues (if relevant)

  1. checkout_agreement_store doesn't exist #18357

Manual testing scenarios

  1. Create a store using table prefixes
  2. Navigate to Store > Terms and Conditions in the admin backend
  3. Without the patch, errors are generated

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Oct 6, 2018

CLA assistant check
All committers have signed the CLA.

@okorshenko
Copy link
Contributor

Hi @pocallaghan
Thank you for your contribution. Could you please sign Contributor License Agreement so that we can proceed with pull request processing. Just follow the URL: https://cla.dev.magento.com/magento/magento2?pullRequest=18412 to sign the CLA

Thank you

@okorshenko okorshenko self-assigned this Oct 6, 2018
@@ -64,7 +64,7 @@ private function getStoresForAgreements()

if (!empty($agreementId)) {
$select = $this->getConnection()->select()->from(
['agreement_store' => 'checkout_agreement_store']
['agreement_store' => $this->getResource()->getTable('checkout_agreement_store')]
Copy link
Contributor

@okorshenko okorshenko Oct 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for your fix. The solution looks reasonable. The reason why this issue appeared is that there is not an integration test for this case. We are running integration tests with and w/o table prefixes to make sure that such issues won't appear.

Please cover this case with the integration test (and earn additional contribution points :) ) to avoid a regression issue for your solution.

Also, could you please fix broken static tests.
Thank you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okobchenko is getResource() really neccessary?

@magento-engcom-team
Copy link
Contributor

Hi @pocallaghan. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants