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

[Catalog Promotion][Docs] update CP scopes docs #13591

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

AdamKasp
Copy link
Contributor

@AdamKasp AdamKasp commented Feb 3, 2022

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

@AdamKasp AdamKasp added the Documentation Documentation related issues and PRs - requests, fixes, proposals. label Feb 3, 2022
@AdamKasp AdamKasp requested a review from a team as a code owner February 3, 2022 11:03
arguments:
- '@sylius.repository.product_variant'
tags:
- { name: 'sylius.catalog_promotion.variants_provider', type: 'by_phrase' }
- { name: 'sylius.catalog_promotion.variant_checker', type: 'for_phrase' }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- { name: 'sylius.catalog_promotion.variant_checker', type: 'for_phrase' }
- { name: 'sylius.catalog_promotion.variant_checker', type: 'by_phrase' }

{
public const TYPE = 'by_phrase';
public const TYPE = 'for_phrase';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public const TYPE = 'for_phrase';
public const TYPE = 'by_phrase';

@GSadee GSadee merged commit aa970f5 into Sylius:1.11 Feb 3, 2022
@GSadee
Copy link
Member

GSadee commented Feb 3, 2022

Thank you, Adam! 🎉

Comment on lines +62 to +66
return in_array(
$productVariant,
$this->productVariantRepository->findByPhrase($configuration['phrase'], 'en_US'),
true
);
Copy link
Member

Choose a reason for hiding this comment

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

It will do almost similar thing(we will not check by code and english locale is not guaranteed), but lets not encourage to load additional data from db at this stage

Suggested change
return in_array(
$productVariant,
$this->productVariantRepository->findByPhrase($configuration['phrase'], 'en_US'),
true
);
return str_contains($productVariant->getName(), $configuration['phrase']);

@AdamKasp AdamKasp deleted the update-catalog-promotion-cookbook branch February 3, 2022 19:14
AdamKasp added a commit that referenced this pull request Feb 4, 2022
… (GSadee)

This PR was merged into the 1.11 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.11
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | resolves comments from #13591
| 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
-->


Commits
-------

4e15ce3 [Cookbook] Minor fixes in custom catalog promotion scope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation related issues and PRs - requests, fixes, proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants