[Translations][Shop][API] Dynamic serialization of translations for a Product, ProductVariant and Taxon entities#13401
Conversation
Rafikooo
commented
Dec 16, 2021
| Q | A |
|---|---|
| Branch? | 1.11 |
| Bug fix? | no |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| License | MIT |
… Product, ProductVariant and Taxon entities
| int $quantity, | ||
| string $customerOrAdmin | ||
| ): void { | ||
| if (!($customerOrAdmin === 'customer' || $customerOrAdmin === 'admin')) { |
There was a problem hiding this comment.
| 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" /> |
There was a problem hiding this comment.
| <property name="name" identifier="false" required="true" /> | |
| <property name="name" required="true" /> |
I guess it is not needed
| <property name="name" identifier="false" required="true" /> | ||
| <property name="description" identifier="false" required="true" /> |
There was a problem hiding this comment.
| <property name="name" identifier="false" required="true" /> | |
| <property name="description" identifier="false" required="true" /> | |
| <property name="name" required="true" /> | |
| <property name="description" required="true" /> |
|
Thank you, Rafał! 🥇 |
| /** | ||
| * @test | ||
| */ |
There was a problem hiding this comment.
| /** | |
| * @test | |
| */ | |
| /** @test */ |
| $this->checkProductQuantity($cartResponse, $productName, $quantity, 'customer'); | ||
| } | ||
|
|
||
| private function checkProductQuantity( |
There was a problem hiding this comment.
Personally, I'm not a fan of this solution. In order to reduce duplication, we've introduced 4 if statements
There was a problem hiding this comment.
Honestly, I don't understand what exactly you mean. Could you describe in other words what I should change?
| "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." |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
can you add slug here as well?