geocoder-php/BazingaGeocoderBundle

Does this work for Symfony 4?

vincentcox opened this issue · 6 comments

The documentation is talking of app/config/config.yml which is not used in Symfony 4 if you use autowiring.
I am trying to use the NominatimGeocoder, but it seems not to work.

    private $NominatimGeocoder;

    public function __construct(Provider $NominatimGeocoder)
    {
        $this->NominatimGeocoder = $NominatimGeocoder;
    }

Cannot autowire service "App\Controller\myController": argument "$NominatimGeocoder" of method "__construct()" references interface "Geocoder\Provider\Provider" but no such service exists. You should maybe alias this interface to the existing "Geocoder\ProviderAggregator" service.

Yes it should work :) Did you try to write as $nominatimGeocoder?
Also would be good to see the part where you configure Nominatim provider instead of just guessing what's wrong :)

@nicolas-grekas The clue is: where do you have to configure this in Symfony 4? I, the services.yaml file?

Good cue for the different nominatimGeocoder naming, if you let me know where to configure this, I'll try again! Thanks!

in services.yaml I suppose yes
but this should be handled by the bundle also, which need to ship with autowiring aliases.
I suppose this could be submitted as a PR.

This bundle ships those autowiring aliases already :)

Hey. So did it work for you?

Really kind to check in. I will check later this evening and will close this issue if solved!