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

Add CountryCodeDataList view helper and CountryCode validator #86

Merged
merged 11 commits into from
Dec 16, 2022

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Sep 13, 2022

Q A
Documentation not yet - required
New Feature yes
RFC no?

Description

Given the addition of the country code value object in #84, this patch puts it to use by adding a list object available in the container, that users can use to retrieve a list of all ISO-3166 alpha 2 country codes. The list implements and is aliased to a simple interface that user can override in the container, for example, in order to restrict the list to desired countries.

A view helper is added that outputs an HTML datalist element, useful for autocomplete and a validator for ISO3166 country codes.

Documentation is outstanding.

@gsteel gsteel added this to the 2.19.0 milestone Sep 13, 2022
@gsteel gsteel force-pushed the feature/country-data-list-and-validator branch from f12b022 to 2a2c6a6 Compare September 13, 2022 16:23
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

Partial review - dropping in some feedback though :-)

src/Geography/DefaultCountryCodeList.php Outdated Show resolved Hide resolved
src/ConfigProvider.php Outdated Show resolved Hide resolved
src/Geography/DefaultCountryCodeList.php Outdated Show resolved Hide resolved
src/Geography/DefaultCountryCodeList.php Outdated Show resolved Hide resolved
src/Geography/DefaultCountryCodeList.php Outdated Show resolved Hide resolved
src/Geography/DefaultCountryCodeList.php Show resolved Hide resolved
src/Geography/DefaultCountryCodeList.php Outdated Show resolved Hide resolved
@gsteel
Copy link
Member Author

gsteel commented Sep 13, 2022

Partial review - dropping in some feedback though

Thanks @Ocramius

src/Geography/CountryCodeListInterface.php Show resolved Hide resolved
src/Geography/DefaultCountryCodeList.php Show resolved Hide resolved
src/Geography/DefaultCountryCodeList.php Show resolved Hide resolved
src/Geography/DefaultCountryCodeListFactory.php Outdated Show resolved Hide resolved
src/View/Helper/CountryCodeDataList.php Outdated Show resolved Hide resolved
@gsteel gsteel force-pushed the feature/country-data-list-and-validator branch from b593ad3 to 240c7dc Compare September 14, 2022 19:51
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

IMO this is good to go, @gsteel!

Do we need to add docs for it, though? 🤔

@Ocramius Ocramius removed this from the 2.19.0 milestone Oct 10, 2022
@Ocramius
Copy link
Member

Clearing milestone for a release meanwhile: will re-target 2.20.x

@Ocramius Ocramius added this to the 2.20.0 milestone Oct 10, 2022
@Ocramius Ocramius changed the base branch from 2.19.x to 2.20.x October 10, 2022 15:54
@gsteel
Copy link
Member Author

gsteel commented Oct 10, 2022

I'll get some docs together for review by @froschdesign soon as I can :)

@Ocramius Ocramius removed this from the 2.20.0 milestone Dec 2, 2022
@gsteel gsteel force-pushed the feature/country-data-list-and-validator branch from 240c7dc to fb3ab42 Compare December 2, 2022 16:19
@gsteel gsteel changed the base branch from 2.20.x to 2.21.x December 2, 2022 16:20
@gsteel gsteel added this to the 2.21.0 milestone Dec 2, 2022
@gsteel
Copy link
Member Author

gsteel commented Dec 2, 2022

Current psalm issues are unrelated - service manager needs an update so I'll do that in another patch

@Ocramius Ocramius removed this from the 2.21.0 milestone Dec 2, 2022
@Ocramius Ocramius changed the base branch from 2.21.x to 2.22.x December 2, 2022 17:25
@Ocramius Ocramius added this to the 2.22.0 milestone Dec 2, 2022
Signed-off-by: George Steel <george@net-glue.co.uk>
Signed-off-by: George Steel <george@net-glue.co.uk>
Signed-off-by: George Steel <george@net-glue.co.uk>
Signed-off-by: George Steel <george@net-glue.co.uk>
@gsteel gsteel force-pushed the feature/country-data-list-and-validator branch from fb3ab42 to 7ebe18a Compare December 15, 2022 22:24
Signed-off-by: George Steel <george@net-glue.co.uk>
…ist`

Psalm doesn't appear to like the size of the array

Signed-off-by: George Steel <george@net-glue.co.uk>
…d CountryCode validator

Signed-off-by: George Steel <george@net-glue.co.uk>
Copy link
Member

@froschdesign froschdesign left a comment

Choose a reason for hiding this comment

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

Good work! 👍🏻

Only a few minor changes are needed.

docs/book/validators/country-code.md Outdated Show resolved Hide resolved
docs/book/view-helpers/country-code-data-list.md Outdated Show resolved Hide resolved
docs/book/view-helpers/country-code-data-list.md Outdated Show resolved Hide resolved
docs/book/view-helpers/country-code-data-list.md Outdated Show resolved Hide resolved
docs/book/view-helpers/country-code-data-list.md Outdated Show resolved Hide resolved
gsteel and others added 2 commits December 16, 2022 09:45
Co-authored-by: Frank Brückner <info@froschdesignstudio.de>
Signed-off-by: George Steel <george@netglue.uk>
Signed-off-by: George Steel <george@net-glue.co.uk>
docs/book/view-helpers/country-code-data-list.md Outdated Show resolved Hide resolved
docs/book/view-helpers/country-code-data-list.md Outdated Show resolved Hide resolved
docs/book/view-helpers/country-code-data-list.md Outdated Show resolved Hide resolved
Co-authored-by: Frank Brückner <info@froschdesignstudio.de>
Signed-off-by: George Steel <george@netglue.uk>
@froschdesign
Copy link
Member

@gsteel
One last step: add the new validator and view helper to the MkDocs configuration file.

laminas-i18n/mkdocs.yml

Lines 20 to 36 in fa9fc18

- Validators:
- Introduction: validators/introduction.md
- Alnum: validators/alnum.md
- Alpha: validators/alpha.md
- DateTime: validators/date-time.md
- IsFloat: validators/is-float.md
- IsInt: validators/is-int.md
- PhoneNumber: validators/phone-number.md
- PostCode: validators/post-code.md
- 'View Helpers':
- Introduction: view-helpers/introduction.md
- CurrencyFormat: view-helpers/currency-format.md
- DateFormat: view-helpers/date-format.md
- NumberFormat: view-helpers/number-format.md
- Plural: view-helpers/plural.md
- Translate: view-helpers/translate.md
- TranslatePlural: view-helpers/translate-plural.md

Thanks in advance! 👍🏻

Signed-off-by: George Steel <george@net-glue.co.uk>
@gsteel
Copy link
Member Author

gsteel commented Dec 16, 2022

Thanks for the help @froschdesign 👍

@gsteel gsteel merged commit 01be81b into laminas:2.22.x Dec 16, 2022
@gsteel gsteel deleted the feature/country-data-list-and-validator branch December 16, 2022 13:53
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.

None yet

3 participants