-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[API][Shop] Viewing only the enabled variants of a product #13863
Merged
lchrusciel
merged 3 commits into
Sylius:master
from
TheMilek:seeing-enabled-variants-of-a-product
Apr 14, 2022
Merged
[API][Shop] Viewing only the enabled variants of a product #13863
lchrusciel
merged 3 commits into
Sylius:master
from
TheMilek:seeing-enabled-variants-of-a-product
Apr 14, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AdamKasp
reviewed
Apr 12, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should add/update contract test too 💯
Rafikooo
reviewed
Apr 12, 2022
GSadee
reviewed
Apr 13, 2022
...undle/ApiBundle/Doctrine/QueryCollectionExtension/ProductVariantsWithEnableFlagExtension.php
Outdated
Show resolved
Hide resolved
...Bundle/spec/Doctrine/QueryCollectionExtension/ProductVariantsWithEnableFlagExtensionSpec.php
Outdated
Show resolved
Hide resolved
...Bundle/spec/Doctrine/QueryCollectionExtension/ProductVariantsWithEnableFlagExtensionSpec.php
Outdated
Show resolved
Hide resolved
c61110c
to
c899c74
Compare
lchrusciel
reviewed
Apr 13, 2022
...dle/ApiBundle/spec/Doctrine/QueryCollectionExtension/EnabledProductVariantsExtensionSpec.php
Outdated
Show resolved
Hide resolved
c899c74
to
90d01dc
Compare
90d01dc
to
6355efc
Compare
6355efc
to
2323962
Compare
AdamKasp
reviewed
Apr 14, 2022
tests/Api/Responses/Expected/admin/get_product_collection_response.json
Outdated
Show resolved
Hide resolved
2323962
to
aabd3d0
Compare
lchrusciel
reviewed
Apr 14, 2022
Comment on lines
+47
to
+48
$variantsIris = array_map(fn(ProductVariantInterface $variant): string => $this->iriConverter->getIriFromItem($variant), $object->getEnabledVariants()->toArray()); | ||
$data['variants'] = array_values($variantsIris); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be equivalent:
Suggested change
$variantsIris = array_map(fn(ProductVariantInterface $variant): string => $this->iriConverter->getIriFromItem($variant), $object->getEnabledVariants()->toArray()); | |
$data['variants'] = array_values($variantsIris); | |
$data['variants'] = $object | |
->getEnabledVariants() | |
->map(fn(ProductVariantInterface $variant): string => $this->iriConverter->getIriFromItem($variant)) | |
->getValues() | |
; |
and seems to me to be more object-oriented and more readable
Thank you, Kamil! 🥇 |
lchrusciel
reviewed
Apr 14, 2022
GSadee
reviewed
Apr 14, 2022
GSadee
added a commit
that referenced
this pull request
May 6, 2022
…duct fixes (TheMilek) This PR was merged into the 1.12-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master <!-- see the comment below --> | Bug fix? | no | New feature? | no | BC breaks? | no | Related tickets | fixes to [PR](#13863) | License | MIT <!-- - Bug fixes must be submitted against the 1.10 or 1.11 branch(the lowest possible) - Features and deprecations must be submitted against the master branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> This PR contains missing QueryItemExtension for ProductVariants that shows only enabled variants and corrects comments from [this](#13863) PR Commits ------- c864bb2 [API][Shop] viewing only enabled variants fixed e366148 Upgrade API file updated
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.
Maintenance
CI configurations, READMEs, releases, etc.
Shop
ShopBundle related issues and PRs.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We haven't got any API scenarios for seeing only enabled variants in shop