-
-
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
Fix notInRangeMessage usage for a few Range validations #14576
Fix notInRangeMessage usage for a few Range validations #14576
Conversation
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.
Nice change, @diimpp! I would leave these min/max messages, as someone can use them in other places in their application. I would also add an UPGRADE file note about it and it's good to be merged 🏅 🎉
@Zales0123 Hi, can we mention removal of translation min,max messages as BC break instead? Or is it a part of hard BC policy? My point is why leave dead But I will update PR to keep them, if it's required. P.S. In related #14584 I've changed |
Hi @diimpp! |
features/promotion/managing_promotions/promotion_validation.feature
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionCouponsContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/PromotionBundle/Resources/translations/validators.ar.yml
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php
Outdated
Show resolved
Hide resolved
c2d8d0e
to
ce986b6
Compare
src/Sylius/Bundle/PromotionBundle/Resources/translations/validators.th.yml
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/PromotionBundle/Resources/translations/validators.th.yml
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/PromotionBundle/Resources/translations/validators.uk.yml
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/PromotionBundle/Resources/translations/validators.zh_CN.yml
Outdated
Show resolved
Hide resolved
ce986b6
to
63e8b69
Compare
Thank you, Dmitri! 🎉 |
This PR was merged into the 1.13 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.13 | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | yes | | Related tickets | partially #14576 | | License | MIT | Continuation of #14576 based on 1.13 due deprecation and changes introduced in 1.12 ```patch --- range: Review rating must be an integer in the range 1-5. +++ not_in_range: Review rating must be between {{ min }} and {{ max }}. ``` [Range](https://symfony.com/doc/current/reference/constraints/Range.html) constraints doesn't validate for integer type, so I've removed mention of this and was forced to remove translated strings from other languages. > Validates that a given number or DateTime object is between some minimum and maximum. Commits ------- Update product review validation's notInRangeMessage Restore sylius.review.rating.range translation key for BC compatibility
Issue
Symfony validation constraint
Range
instroduced new behavior since 4.4 release -- if bothmin
andmax
options are defined, thennotInRangeMessage
will be shown andminMessage
/maxMessage
will be disregarded.Example
If you will try to generate coupons for promotion with code length larger than 40, then you will see symfony standard message
notInRangeMessage: This value should be between {{ min }} and {{ max }}.
instead of syliusmaxMessage: Coupon code must not be longer than {{ limit }} characters.
Case 1
Sylius/src/Sylius/Bundle/PromotionBundle/Resources/config/validation/PromotionCouponGeneratorInstruction.xml
Lines 33 to 37 in 9506c80
Case 2
Sylius/src/Sylius/Bundle/PromotionBundle/Form/Type/Action/UnitPercentageDiscountConfigurationType.php
Lines 35 to 41 in 9506c80
Case 3
Sylius/src/Sylius/Bundle/ApiBundle/Resources/config/validation/AddProductReview.xml
Lines 23 to 28 in 9506c80
range
tonot_in_range
Questions
sylius.promotion_coupon_generator_instruction.code_length.min
and...max
messages constitute a deprecation entry? Because those translation strings were inactive (effectively deprecated by symfony upgrade) since project was upgraded to symfony 4.4 and even if somebody has custom translation over there, it has no effect whatsoever.