Skip to content

fix: customer.language maps to shopId, not localeId - adding correct association#13

Open
PantherX99 wants to merge 3 commits into
shopware:trunkfrom
PantherX99:patch-1
Open

fix: customer.language maps to shopId, not localeId - adding correct association#13
PantherX99 wants to merge 3 commits into
shopware:trunkfrom
PantherX99:patch-1

Conversation

@PantherX99

Copy link
Copy Markdown

when migrating, unnecessary / unused languages are created. this is due to the mapping of customer.language which maps to the shopid and not the localeid.

this causes SWAG_MIGRATION_WRITE_EXCEPTION errors, because it assigns a wrong language id to the customer, so the customer cant be created and their order neither as well.

[/languageId] The language "019e88ab8071730686a04a88ca695f99" is not assigned to the sales channel. in /var/www/vhosts/c8yb4.creoline.cloud/httpdocs/vendor/shopware/core/Framework/DataAbstractionLayer/Write/WriteContext.php:46
Converted data (JSON):

/**

Id of the language sub shop
var string
Orm\Column(name="language", type="string", length=10, nullable=false)
*/
private $languageId = '1';

Added additional joins for customer language and shop ID mapping.
Added left joins to fetch customer locale IDs along with language. customer.language maps to shopID and not directly to localeID

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Small suggestion for the PR title:

fix: resolve customer language through shop locale

This would be a bit shorter and describes the fix rather than the issue.

'customer',
's_core_shops',
'customerlanguageshop',
'customer.language = customerlanguageshop.id'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you please update the failing test for this change? It still checks the old behavior that your PR fixes.

There was 1 failure:

1) Tests\Functional\Service\LanguageServiceTest::testReadIncludesCustomerLocalesOutsideShopLocales
Failed asserting that an array contains 'zz-ZZ'.

Tests/Functional/Service/LanguageServiceTest.php:49

'customer',
's_core_shops',
'customerlanguageshop',
'customer.language = customerlanguageshop.id'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add a test for this customer language mapping 🙂

'customerlanguageshop',
'customer.language = customerlanguageshop.id'
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The codestyle_php pipeline reports no_whitespace_in_blank_line in both changed files. Removing the spaces on the empty lines should fix that.

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

Labels

external-contribution A PR contributed by a community member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants