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 hardcoded country/country code to addresses #7

Closed

Conversation

DieterHolvoet
Copy link

When using the StringFormatter class to format addresses returned by this provider, the country is empty. Since this provider only works with Belgian addresses, we should add the country hardcoded to every address so it can be used when formatting.

@jbelien
Copy link
Member

jbelien commented Sep 22, 2022

Hello @DieterHolvoet ,
Thank you for your contribution!

Even though I get your point, we never change data coming from a provider in Geocoder PHP.
If, for any reason and pretty unlikely, Geopunt decides to extend outside Belgium, doing such change would return a false result.

That logic will have to be handled at your application level (instead of Geocoder PHP level).
You can of course add that information yourself to the Geocoder PHP result in your application.

@jbelien jbelien closed this Sep 22, 2022
@DieterHolvoet
Copy link
Author

You can of course add that information yourself to the Geocoder PHP result in your application.

That's the problem: you can't. Geocoder\Model\Address doesn't have setters, so there's no way to add the country to the geocoding result before passing it to the StringFormatter.

If they ever decide to expand outside of Belgium and pass a Country field to their responses, we would have to update the package anyway. Why not set it to Belgium until then?

@jbelien
Copy link
Member

jbelien commented Sep 22, 2022

That's the problem: you can't. Geocoder\Model\Address doesn't have setters, so there's no way to add the country to the geocoding result before passing it to the StringFormatter.

Sorry, I just checked and you're indeed right.

If they ever decide to expand outside of Belgium and pass a Country field to their responses, we would have to update the package anyway. Why not set it to Belgium until then?

Because I don't want to change anything coming from Geopunt.
It's not the goal of Geocoder PHP, the goal is only to return a common interface.

@JTubex JTubex mentioned this pull request Jun 5, 2023
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

Successfully merging this pull request may close these issues.

2 participants