geocoder-php / BazingaGeocoderBundle

Integration of the Geocoder library into Symfony.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nominatim::_construct expects min 3 arguments; config & factory only allow for 2

kklecho opened this issue · comments

When trying to use Nominatim provider I get this error:
Too few arguments to function Geocoder\Provider\Nominatim\Nominatim::__construct(), 2 passed

This happens here:

//NominatimFactory.php:30
return new Nominatim($httplug, $config['root_url']);

Nominatim since version 4.1 requires $userAgent and allows for $referer:

(v.4.1 commit line)

//Nominatim.php:68
-    public function __construct(HttpClient $client, $rootUrl)
+    public function __construct(HttpClient $client, $rootUrl, string $userAgent, string $referer = ''

my config:

bazinga_geocoder:
    providers:
        nominatim:
            factory: Bazinga\GeocoderBundle\ProviderFactory\NominatimFactory
            options:
                httplug_client: '@httplug.client' # When using HTTPlugBundle
                root_url: 'https://nominatim.openstreetmap.org'

This Issue can be closed now.

Closed by #198