src/Sulu/Bundle/LocationBundle/Controller/GeolocatorController.php
public function queryAction(Request $request)
    {
        $geolocatorName = $request->get('providerName');
        $query = $request->get('query');

        try {
            $geolocator = $this->geolocatorManager->get($geolocatorName);
        } catch (GeolocatorNotFoundException $e) {
            throw new NotFoundHttpException(
                sprintf(
                    'Wrapped "%s"',
                    $e->getMessage()
                ),
                $e
            );
        }

        $res = $geolocator->locate($query);

        return new JsonResponse(['_embedded' => ['locations' => $res->toArray()]]);
    }
public function queryAction(Request $request)
    {
        $geolocatorName = $request->get('providerName');
        $query = $request->get('query');

        try {
            $geolocator = $this->geolocatorManager->get($geolocatorName);
        } catch (GeolocatorNotFoundException $e) {
            throw new NotFoundHttpException(
                sprintf(
                    'Wrapped "%s"',
                    $e->getMessage()
                ),
                $e
            );
        }

        $res = $geolocator->locate($query);

        return new JsonResponse(['_embedded' => ['locations' => $res->toArray()]]);
    }
public function queryAction ( Request $ request ) { $ geolocatorName = $ request -> get ( 'providerName' ) ; $ query = $ request -> get ( 'query' ) ; try { $ geolocator = $ this -> geolocatorManager -> get ( $ geolocatorName ) ; } catch ( GeolocatorNotFoundException $ e ) { throw new NotFoundHttpException ( sprintf ( 'Wrapped "%s"' , $ e -> getMessage ( ) ) , $ e ) ; } $ res = $ geolocator -> locate ( $ query ) ; return new JsonResponse ( [ '_embedded' => [ 'locations' => $ res -> toArray ( ) ] ] ) ; }
Query the configured geolocation service.

@param Request $request

@return JsonResponse
Query the configured geolocation service .