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

Lookup state by iso code? #2

Closed
kwilliams opened this issue Jun 23, 2016 · 5 comments
Closed

Lookup state by iso code? #2

kwilliams opened this issue Jun 23, 2016 · 5 comments

Comments

@kwilliams
Copy link

I'm having trouble finding a way to lookup a state by iso code, is this possible?

@kwilliams
Copy link
Author

After poking through the matching function it looks like in order to do this we need to overload the toArray method of the State class, can I submit a pull request?

@kwilliams kwilliams reopened this Jun 23, 2016
@dusterio
Copy link
Member

Hi!

Have you tried $states->findOne(['isoCode' => $code])? Or directly from a country: $country->getStates()->findOne(...)

@kwilliams
Copy link
Author

kwilliams commented Jun 24, 2016

Yeah, the problem I'm running into is that the toArray method needs to be overridden with the getters for each Member.

Geographer::findOne(['code' => 'US'])->findOne(['isoCode' => 'TX']);
=> false

The match method casts each object to an array before searching for key value pairs, which ends up limiting the search parameters \MenaraSolutions\Geographer\Divisible@toArray.

@kwilliams
Copy link
Author

kwilliams commented Jun 24, 2016

I see that this has been fixed in master, can we get a release for Composer purposes?

I need the magic getter from this commit: 0d64ea0

🙏

@dusterio
Copy link
Member

Sure, it's done. I didn't actually expect anybody to download this package before July ;-) I'm in the middle of preparing the first public release and a blog post with documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants