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

Already on GitHub? Sign in to your account

Convert iri to code in command AddProductReview #12498

Conversation

Tomanhez
Copy link
Contributor

@Tomanhez Tomanhez commented Mar 31, 2021

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

This is extension and improvement for create generic transformation command field iri's to code: #12487

@Tomanhez Tomanhez requested a review from a team as a code owner March 31, 2021 08:57
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Mar 31, 2021
@Tomanhez Tomanhez added the Feature New feature proposals. label Mar 31, 2021
@Tomanhez Tomanhez changed the title Convert iri to code in command add product review Convert iri to code in command AddProductReview Mar 31, 2021
@Tomanhez Tomanhez force-pushed the convert-iri-to-code-in-command-add-product-review branch 2 times, most recently from b07cb55 to 507c828 Compare March 31, 2021 11:36
src/Sylius/Bundle/ApiBundle/Resources/config/services.xml Outdated Show resolved Hide resolved
Comment on lines +56 to +63
$denormalizedInput = $this->objectNormalizer->denormalize($data, $this->getInputClassName($context), $format, $context);

if ($this->commandAwareInputDataTransformer->supportsTransformation($denormalizedInput, $type, $context)) {
return $this->commandAwareInputDataTransformer->transform($denormalizedInput, $type, $context);
}

return $denormalizedInput;
Copy link
Member

Choose a reason for hiding this comment

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

What is the problem with?:

Suggested change
$denormalizedInput = $this->objectNormalizer->denormalize($data, $this->getInputClassName($context), $format, $context);
if ($this->commandAwareInputDataTransformer->supportsTransformation($denormalizedInput, $type, $context)) {
return $this->commandAwareInputDataTransformer->transform($denormalizedInput, $type, $context);
}
return $denormalizedInput;
return $this->objectNormalizer->denormalize($data, $this->getInputClassName($context), $format, $context);

Data transformer should be used regardless of that we are decorating denormalizer or not

@Tomanhez Tomanhez force-pushed the convert-iri-to-code-in-command-add-product-review branch from 507c828 to 3521679 Compare March 31, 2021 13:11
@GSadee GSadee merged commit ef8bc2e into Sylius:master Mar 31, 2021
@GSadee
Copy link
Member

GSadee commented Mar 31, 2021

Thanks, Tomasz! 🥇

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. Feature New feature proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants