2amigos / yii2-google-maps-library

Google Maps API library for Yii2
https://2amigos.us
BSD 3-Clause "New" or "Revised" License
105 stars 79 forks source link

Geocoding is breaking with guzzle #58

Closed newscloud closed 8 years ago

newscloud commented 8 years ago

My code stopped working with recent updates to composer components ... Now geocoding request gets a guzzle error related to maps

PHP Fatal Error – yii\base\ErrorException Call to undefined method GuzzleHttp\Psr7\Response::json()

See the error here http://screencast.com/t/uai9ya5Gu6

Code that generates above: 'full_address' => '1522 SE 44th Ave, Portland, OR 97214', address here slightly different

use dosamigos\google\maps\services\GeocodingClient; ... public function addLocationFromAddress($model,$full_address='') { // finds gps coordinates from full_address field if available if ($full_address=='') return false; $gc = new GeocodingClient(); $result = $gc->lookup(array('address'=>$full_address,'components'=>1)); $location = $result['results'][0]['geometry']['location']; if (!is_null($location)) { $lat = $location['lat']; $lng = $location['lng']; // add GPS entry in PlaceGeometry $this->addGeometryByPoint($model,$lat,$lng); } }

My composer.json: "require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.7", "yiisoft/yii2-bootstrap": "", "yiisoft/yii2-swiftmailer": "", "openbuildings/swiftmailer-css-inliner":"", "2amigos/yii2-google-maps-library": "", "2amigos/yii2-google-places-library": "", "stichoza/google-translate-php": "~2.0", "google/apiclient": "1.0.@beta", "2amigos/yii2-date-time-picker-widget": "", "yiisoft/yii2-jui": "", "cebe/yii2-gravatar": "", "kartik-v/yii2-widget-fileinput": "", "yiisoft/yii2-imagine": "", "2amigos/yii2-resource-manager-component": "0.1.", "yiisoft/yii2-authclient": "~2.0.0", "mailgun/mailgun-php": "~2.0", "guzzlehttp/guzzle":"6.2.0 as 4.2.3", "php-http/guzzle6-adapter":"1.0.0",

kudzuu commented 8 years ago

Yep, i have to take out all 2amigos components and rewrite it for new Guzzle.

tonydspaniard commented 8 years ago

@kudzuu @newscloud it has been fixed: https://github.com/2amigos/yii2-google-maps-library/blob/master/ClientAbstract.php#L72

I'll update the library now

tonydspaniard commented 8 years ago

done, please update to 1.0.1 sorry i do not have much time to do what i really want with this lib.