egeloen / IvoryGoogleMapBundle

Google Map API v3 integration for your Symfony2 project.
https://github.com/egeloen/ivory-google-map
MIT License
217 stars 152 forks source link

Error for the distance matrix #134

Closed alexbaciu closed 8 years ago

alexbaciu commented 9 years ago

Hello,

I am trying to use the distance matrix to get the estimated distance between 2 addresses. My Composer looks like this:

    "egeloen/google-map-bundle": "~2.2",
    "willdurand/geocoder": "*",
    "widop/http-adapter-bundle": "1.1.*",
    "widop/http-adapter": "~1.0.0"

I am receiving the following error:

FatalErrorException: Error: Call to a member function getStatusCode() on a non-object in /var/www/.../vendor/egeloen/google-map/src/Services/AbstractService.php line 259

The config file looks like this:

distance_matrix:
    # Enable the service
    enabled: true

    # Your own directions class
    #class: "My\Fucking\DistanceMatrix"

    # The http adapter
    adapter: "widop_http_adapter.curl"

    # The Directions API URL
    url: "http://maps.googleapis.com/maps/api/distancematrix"

    # TRUE if the service uses HTTPS else FALSE
    https: false

    # The format used (json or xml)
    format: "json"

distance_matrix_request:
    # Your own distance matrix request class
    #class: "My\Fucking\DirectionsRequest"

    # TRUE if the distance matrix should avoid highways else FALSE
    # By default there is no avoid highways.
    avoid_highways: false

    # TRUE if the distance matrix should avoid tolls else FALSE
    # By default there is no avoid tolls.
    avoid_tolls: false

    # The region used to filter the distance matrix results.
    # By default there is no region.
    region: "us"

    # The language used for this request.
    # By default there is no language.
    language: "en"

    # The travel mode used to filter distance matrix results.
    # By default there is no travel mode.
    travel_mode: "DRIVING"

    # The unit system used.
    # By default there is no unit system.
    unit_system: "IMPERIAL"

    # Indicates whether or not the directions request comes from a device with a location sensor
    # By default, the sensor is false
    sensor: false

Any Ideas?

egeloen commented 9 years ago

Just update your composer.json with the following:

"egeloen/google-map-bundle": "~2.2",
"willdurand/geocoder": "*",
"widop/http-adapter-bundle": "~1.2"

The widop/http-adapter package can be removed as it is a dependency of the widop/http-adapter-bundle package.

alexbaciu commented 9 years ago

Hello,

I've tried that but I am receiving the following errors:

Problem 1

Potential causes:

egeloen commented 8 years ago

This has been fixed in #159 but will only be part of the 3.x version of the bundle.