-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Form] Add new active_at, not_active_at and legal_tender options to CurrencyType
#61837
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
[Form] Add new active_at, not_active_at and legal_tender options to CurrencyType
#61837
Conversation
|
Is it necessary to add more tests given that the filtering method |
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
active, legal_tender and date options to CurrencyTypeactive, legal_tender and active_or_not_at options to CurrencyType
src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
Show resolved
Hide resolved
src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
Show resolved
Hide resolved
|
should we force the new defaults in a deprecated manner? |
@ro0NL |
|
I don't understand why we need active and active_or_not_at? That's to cover the need of listing only non-active currencies at a given date? Is that a common enough usecase? |
IMHO yes it could be a common use case to list only the non-active currencies for a given date, for the following reasons:
WDYT @nicolas-grekas ? |
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
active, legal_tender and active_or_not_at options to CurrencyTypeactive_at, active_or_not_at and legal_tender options to CurrencyType
active_at, active_or_not_at and legal_tender options to CurrencyTypeactive_at, not_active_at and legal_tender options to CurrencyType
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
|
@nicolas-grekas A part from that I think I forgot to process the eventual |
|
If we want to account for the TZ, maybe we should put timestamps in the metadata instead of date strings? (if that's what we have right now) |
Yes, or we could convert the |
|
it might be more readable to have Y-m-d H:i:s UTC strings indeed |
Ok 👍🏻 Do I create another PR for this or can I do the required changes in the current one ? |
|
It should be a separate PR targetting branch 6.4 |
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
Outdated
Show resolved
Hide resolved
| return array_flip($filteredCurrencyNames); | ||
| }, | ||
| ), | ||
| $choiceTranslationLocale.($activeAt ?? $notActiveAt)?->format('Y-m-d\TH:i:s').$legalTenderCacheKey, |
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.
Note: Some timezones use unusual offsets, with the smallest official step being 15 minutes. I used the seconds as the smallest units but we could use only minutes if we wanted to.
…dity (Crovitche-1623) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Intl] Support time in generated data in currencies validity | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT `@nicolas`-grekas see #61837 (comment) Note: This PR is a prerequisite of #61837 Commits ------- ed53287 [Intl] Support time in generated data in currencies validity
…s to `CurrencyType`
dcf0f08 to
a378fe6
Compare
|
Thank you @Crovitche-1623. |
This PR was merged into the 7.4 branch. Discussion ---------- [Form] do not install symfony/intl < 7.4 | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT the changes done in #61837 require #61431 Commits ------- badf463 do not install symfony/intl < 7.4
Add the options
active_at,not_active_atandlegal_tenderfrom #61431 that give the possibility to filter the currencies more precisely. For instance:active_at(todayby default)Regarding BC compatibility, if people want to have the same results as prior 7.4, they should set the
active_atandlegal_tenderoptions to null explicitely.