src/Norm/Connection/BonoConnection.php
public function restGet($cursor) {
        if ($cursor instanceof Cursor) {
            $name = $cursor->getCollection()->getName();
            $criteria = $cursor->getCriteria();
            $limit = $cursor->limit();
            $skip = $cursor->skip();
            $sorts = $cursor->sort();

            $query = array();

            foreach ($criteria as $key => $value) {
                $query[$key] = $value;
            }

            if ($limit) {
                $query['!limit'] = $limit;
            }

            if ($skip) {
                $query['!skip'] = $skip;
            }

            if (!empty($sorts)) {
                foreach ($sorts as $key => $value) {
                    $query["!sort[$key]"] = $value;
                }
            }

            $qs = array();

            foreach ($query as $key => $value) {
                if (is_array($value)) {
                    foreach ($value as $k => $v) {
                        $qs[] = '!'.$key.'='.$v;
                    }
                } else {
                    $qs[] = $key.'='.$value;
                }
            }

            if ($qs) {
                $qs = '?'.implode('&', $qs);
            } else {
                $qs = '';
            }

            $url = $this->option('baseUrl').'/'.$name.'.json'.$qs;

            $client = new Client();
            $response = $client->get($url)->send();

            return json_decode($response->getBody(true), true);
        } else {
            throw new Exception('Unimplemented yet!');
        }
    }
public function restGet($cursor) {
        if ($cursor instanceof Cursor) {
            $name = $cursor->getCollection()->getName();
            $criteria = $cursor->getCriteria();
            $limit = $cursor->limit();
            $skip = $cursor->skip();
            $sorts = $cursor->sort();

            $query = array();

            foreach ($criteria as $key => $value) {
                $query[$key] = $value;
            }

            if ($limit) {
                $query['!limit'] = $limit;
            }

            if ($skip) {
                $query['!skip'] = $skip;
            }

            if (!empty($sorts)) {
                foreach ($sorts as $key => $value) {
                    $query["!sort[$key]"] = $value;
                }
            }

            $qs = array();

            foreach ($query as $key => $value) {
                if (is_array($value)) {
                    foreach ($value as $k => $v) {
                        $qs[] = '!'.$key.'='.$v;
                    }
                } else {
                    $qs[] = $key.'='.$value;
                }
            }

            if ($qs) {
                $qs = '?'.implode('&', $qs);
            } else {
                $qs = '';
            }

            $url = $this->option('baseUrl').'/'.$name.'.json'.$qs;

            $client = new Client();
            $response = $client->get($url)->send();

            return json_decode($response->getBody(true), true);
        } else {
            throw new Exception('Unimplemented yet!');
        }
    }
public function restGet ( $ cursor ) { if ( $ cursor instanceof Cursor ) { $ name = $ cursor -> getCollection ( ) -> getName ( ) ; $ criteria = $ cursor -> getCriteria ( ) ; $ limit = $ cursor -> limit ( ) ; $ skip = $ cursor -> skip ( ) ; $ sorts = $ cursor -> sort ( ) ; $ query = array ( ) ; foreach ( $ criteria as $ key => $ value ) { $ query [ $ key ] = $ value ; } if ( $ limit ) { $ query [ '!limit' ] = $ limit ; } if ( $ skip ) { $ query [ '!skip' ] = $ skip ; } if ( ! empty ( $ sorts ) ) { foreach ( $ sorts as $ key => $ value ) { $ query [ "!sort[$key]" ] = $ value ; } } $ qs = array ( ) ; foreach ( $ query as $ key => $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { $ qs [ ] = '!' . $ key . '=' . $ v ; } } else { $ qs [ ] = $ key . '=' . $ value ; } } if ( $ qs ) { $ qs = '?' . implode ( '&' , $ qs ) ; } else { $ qs = '' ; } $ url = $ this -> option ( 'baseUrl' ) . '/' . $ name . '.json' . $ qs ; $ client = new Client ( ) ; $ response = $ client -> get ( $ url ) -> send ( ) ; return json_decode ( $ response -> getBody ( true ) , true ) ; } else { throw new Exception ( 'Unimplemented yet!' ) ; } }
Get data from rest service.

@param \Norm\Cursor $cursor

@throws \Exception

@return array
Get data from rest service .