Skip to content

ReflectionException: Class Chain does not exist #68

@alexc-hollywood

Description

@alexc-hollywood

General Information

GeocoderLaravel Version: 1.0.1
Laravel Version: 7.4
PHP Version: 7.1
Operating System and Version: Ubuntu 16

Issue Description

Can't reverse geocode because of Chain error.

Steps to Replicate

Function calling the package:

  public function reverse_geocode($lat, $lon) {
    try {
      $result = Geocoder::reverse($lat, $lon);
      $data = $result->toArray();

      \DB::table('geocoded')->insert([
        'type'        => 'reverse',
        'q'           => $lat.','.$lon,
        'lat'         => $data['latitude'],
        'lon'         => $data['longitude'],
        'coords'      => \DB::raw("GeomFromText('POINT(".$data['longitude']." ".$data['latitude'].")')"),
        'bounds'      => json_encode($data['bounds']),
        'street'      => $data['streetNumber'] .' '.$data['streetName'],
        'zip'         => $data['zipcode'],
        'city'        => $data['city'],
        'district'    => $data['cityDistrict'],
        'county'      => $data['county'],
        'region'      => $data['region'],
        'state'       => $data['regionCode'],
        'country'     => $data['countryCode'],
        'created_at'  => new \Carbon\Carbon,
        'updated_at'  => new \Carbon\Carbon
      ]);

      return $result;

    } catch( \Exception $e ) {
      \Log::error($e);
      return false;
    }
  }

Stack Trace

Development.ERROR: ReflectionException: Class Chain does not exist in /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php:71
Stack trace:
#0 /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php(71): ReflectionClass->__construct('Chain')
#1 [internal function]: Geocoder\Laravel\Providers\GeocoderService->Geocoder\Laravel\Providers{closure}(Array, 'Chain')
#2 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Collection.php(684): array_map(Object(Closure), Array, Array)
#3 /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php(78): Illuminate\Support\Collection->map(Object(Closure))
#4 /srv/Demo.com/dev/vendor/toin0u/geocoder-laravel/src/Providers/GeocoderService.php(54): Geocoder\Laravel\Providers\GeocoderService->getProviders(Object(Illuminate\Support\Collection))
#5 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(716): Geocoder\Laravel\Providers\GeocoderService->Geocoder\Laravel\Providers{closure}(Object(Illuminate\Foundation\Application), Array)
#6 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(598): Illuminate\Container\Container->build(Object(Closure))
#7 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(567): Illuminate\Container\Container->resolve('geocoder')
#8 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): Illuminate\Container\Container->make('geocoder')
#9 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(1139): Illuminate\Foundation\Application->make('geocoder')
#10 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(159): Illuminate\Container\Container->offsetGet('geocoder')
#11 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(128): Illuminate\Support\Facades\Facade::resolveFacadeInstance('geocoder')
#12 /srv/Demo.com/dev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(215): Illuminate\Support\Facades\Facade::getFacadeRoot()
#13 /srv/Demo.com/dev/app/Http/Controllers/Front/BaseController.php(264): Illuminate\Support\Facades\Facade::__callStatic('reverse', Array)
#14 /srv/Demo.com/dev/app/Traits/GeoSearchHelper.php(364): Demo\Http\Controllers\Front\BaseController->reverse_geocode(43.6861, -79.4025)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions