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

[API][Product] Expose default variant on product show and index #12649

Merged
merged 4 commits into from
May 19, 2021

Conversation

GSadee
Copy link
Member

@GSadee GSadee commented May 19, 2021

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

@GSadee GSadee added the API APIs related issues and PRs. label May 19, 2021
@GSadee GSadee requested a review from a team as a code owner May 19, 2021 10:01
@GSadee GSadee force-pushed the api-expose-default-variant branch from c3ff2c1 to 1639cb0 Compare May 19, 2021 10:41
{
Assert::isInstanceOf($object, ProductInterface::class);

$context[self::ALREADY_CALLED] = true;
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should add assert of early return in case this class is already called indeed?

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO there is no need, because this check is in supportsNormalization method, but I can add it to be in 100% secured


public function supportsNormalization($data, $format = null, $context = []): bool
{
if (isset($context[self::ALREADY_CALLED])) {
Copy link
Member

Choose a reason for hiding this comment

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

I would add one more spec for testing of this logic

@lchrusciel lchrusciel merged commit b6b95db into Sylius:master May 19, 2021
@lchrusciel
Copy link
Member

Thanks, Grzegorz! 🥇

@GSadee GSadee deleted the api-expose-default-variant branch May 19, 2021 12:55
AdamKasp added a commit that referenced this pull request May 20, 2021
…er (GSadee)

This PR was merged into the 1.10-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | yes?
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes ##12649
| License         | MIT


Commits
-------

ef97569 [API][Product] Add additional specs for product normalizer
AdamKasp added a commit to Sylius/SyliusApiBundle that referenced this pull request May 20, 2021
…er (GSadee)

This PR was merged into the 1.10-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | yes?
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes #Sylius/Sylius#12649
| License         | MIT


Commits
-------

ef975695645c3b0176d733da55a857aa77f2bfc5 [API][Product] Add additional specs for product normalizer
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.

None yet

2 participants