Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validation] Documented the intlCompatible option in Timezone constraint #12057

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

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

javiereguiluz
Copy link
Member

@javiereguiluz javiereguiluz commented Jul 29, 2019

Fixes #11502.

In addition to documenting the intlCompatible option, it sorts all the options alphabetically, like we always do for constraints.

Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

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

The fixed issue is #11502 ;)

@javiereguiluz
Copy link
Member Author

Thanks for the review Roland. I've reworded most of it.

The default value of this option depends on your application. If the
:doc:`Intl component </components/intl>` is available in the application, the
default value is ``true``; otherwise, it's ``false`` by default.

Copy link
Contributor

Choose a reason for hiding this comment

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

so this option is really confusing i guess :)

both PHP+SF intl timezones are considered valid, regardless of this option. The SF intl timezones are only considered valid if the component is available.

However, because of 2 possible different versions of ICU (the version used to compile SF intl vs. the version used by ext-intl compiled in PHP) an edge case might occur:

if a timezone is considered valid by SF intl (based on the latest ICU version in SF), it might be unknown when using it in PHP (e.g. $model = \IntlTimeZone::createTimeZone($tzValidatedBySfIntl);) due a different ICU version PHP is compiled with.

Copy link
Contributor

Choose a reason for hiding this comment

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

so the TLDR of this option is, it ensures you can use the timezone ID with IntlTimeZone::createTimeZone($tz) :) and you'll never get Etc/Unknown

Copy link
Member Author

@javiereguiluz javiereguiluz Jul 30, 2019

Choose a reason for hiding this comment

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

Yes, the name of this option is super confusing. The name tells me that true/false enables/disables support for Intl timezones.

But you say that Intl is unconditionally enabled. The, when should I set this option to true/false and what does it do? Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

did you see the last comment?

"intl" can mean 2 things: SF Intl or PHP Intl (https://www.php.net/manual/en/book.intl.php). Here it means the latter

We have no control of the ICU version used by PHP, hence this option to ensure a valid timezone ID when using \IntlTimeZone for a model (this class is provided by PHP Intl)

Copy link
Contributor

Choose a reason for hiding this comment

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

so TLDR :D

set this option to true if you're modelling the validated timezone ID with \IntlTimeZone, or aim to do so in the future and you want to prepare your data already

Copy link
Member Author

Choose a reason for hiding this comment

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

Phewwww ... I think I finally understood this! Please review the latest reword ... and thanks for your patience 😅

Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

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

👍

@xabbuh
Copy link
Member

xabbuh commented Jul 30, 2019

I think we should the reordering in 3.4 branch to avoid merge conflicts between branches.

@javiereguiluz
Copy link
Member Author

@xabbuh but this article was introduced in Symfony 4.3 version, right? 🙈

@xabbuh
Copy link
Member

xabbuh commented Jul 30, 2019

Sorry, I missed that the constraint was added in 4.3. 🙈

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

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

Great work Javier ❤️👏

@javiereguiluz javiereguiluz merged commit 6440a37 into symfony:4.3 Jul 31, 2019
javiereguiluz added a commit that referenced this pull request Jul 31, 2019
…ezone constraint (javiereguiluz)

This PR was squashed before being merged into the 4.3 branch (closes #12057).

Discussion
----------

[Validation] Documented the intlCompatible option in Timezone constraint

Fixes #11502.

In addition to documenting the `intlCompatible` option, it sorts all the options alphabetically, like we always do for constraints.

Commits
-------

6440a37 [Validation] Documented the intlCompatible option in Timezone constraint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants