Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Translations][Shop][API] Dynamic serialization of translations for a Product, ProductVariant and Taxon entities#13401

Merged
GSadee merged 1 commit into
Sylius:1.11from
Rafikooo:shop-serialization-of-entities-with-translations
Dec 17, 2021
Merged

[Translations][Shop][API] Dynamic serialization of translations for a Product, ProductVariant and Taxon entities#13401
GSadee merged 1 commit into
Sylius:1.11from
Rafikooo:shop-serialization-of-entities-with-translations

Conversation

@Rafikooo
Copy link
Copy Markdown
Contributor

Q A
Branch? 1.11
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
License MIT

@Rafikooo Rafikooo requested a review from a team as a code owner December 16, 2021 14:26
@probot-autolabeler probot-autolabeler Bot added the API APIs related issues and PRs. label Dec 16, 2021
Comment thread src/Sylius/Behat/Service/SprintfResponseEscaper.php
int $quantity,
string $customerOrAdmin
): void {
if (!($customerOrAdmin === 'customer' || $customerOrAdmin === 'admin')) {
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.

Suggested change
if (!($customerOrAdmin === 'customer' || $customerOrAdmin === 'admin')) {
if ($customerOrAdmin !== 'customer' && $customerOrAdmin !== 'admin') {


<property name="id" identifier="false" writable="false" />
<property name="code" identifier="true" required="true" />
<property name="name" identifier="false" required="true" />
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.

Suggested change
<property name="name" identifier="false" required="true" />
<property name="name" required="true" />

I guess it is not needed

Comment on lines +64 to +65
<property name="name" identifier="false" required="true" />
<property name="description" identifier="false" required="true" />
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.

Suggested change
<property name="name" identifier="false" required="true" />
<property name="description" identifier="false" required="true" />
<property name="name" required="true" />
<property name="description" required="true" />

@GSadee GSadee merged commit 452d665 into Sylius:1.11 Dec 17, 2021
@GSadee
Copy link
Copy Markdown
Member

GSadee commented Dec 17, 2021

Thank you, Rafał! 🥇

Comment on lines +44 to +46
/**
* @test
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* @test
*/
/** @test */

$this->checkProductQuantity($cartResponse, $productName, $quantity, 'customer');
}

private function checkProductQuantity(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Personally, I'm not a fan of this solution. In order to reduce duplication, we've introduced 4 if statements

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Honestly, I don't understand what exactly you mean. Could you describe in other words what I should change?

Comment on lines -12 to +13
"translations": {
"de_DE": {
"@id": "\/api\/v2\/shop\/taxon-translations\/@integer@",
"@type": "TaxonTranslation",
"id": "@integer@",
"name": "Tassen",
"slug": "tassen",
"description": "Einige Beschreibung Lorem ipsum dolor sit amet."
},
"en_US": {
"@id": "\/api\/v2\/shop\/taxon-translations\/@integer@",
"@type": "TaxonTranslation",
"id": "@integer@",
"name": "Mugs",
"slug": "categories\/mugs",
"description": "Some description Lorem ipsum dolor sit amet."
}
}
"name": "Mugs",
"description": "Some description Lorem ipsum dolor sit amet."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lets add slug to the response (or did you had reason not to?). Also, please mention about this change in UPGRADE-API-1.11.md

"createdAt": @date@,
"updatedAt": @date@,
"description": "This is a mug",
"shortDescription": "Short mug description",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you add slug here as well?

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

Labels

API APIs related issues and PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants