src/ngrest/render/RenderCrud.php
public function apiQueryString($type)
    {
        // basic query
        $query = ['ngrestCallType' => $type];

        $fields = [];
        foreach ($this->model->primaryKey() as $n) {
            $fields[] = $n;
        }
        // see if we have fields for this type
        if (count($this->getFields($type)) > 0) {
            foreach ($this->getFields($type) as $field) {
                $fields[] = $field;
            }
        }
        // do we have extra fields to expand
        if (count($this->config->getPointerExtraFields($type)) > 0) {
            $query['expand'] = implode(',', $this->config->getPointerExtraFields($type));
        }
        
        array_unique($fields);
        $query['fields'] = implode(",", $fields);

        if (Yii::$app->request->get('pool')) {
            $query['pool'] = Yii::$app->request->get('pool');
        }

        // return url decoded string from http_build_query
        return http_build_query($query, '', '&');
    }
public function apiQueryString($type)
    {
        // basic query
        $query = ['ngrestCallType' => $type];

        $fields = [];
        foreach ($this->model->primaryKey() as $n) {
            $fields[] = $n;
        }
        // see if we have fields for this type
        if (count($this->getFields($type)) > 0) {
            foreach ($this->getFields($type) as $field) {
                $fields[] = $field;
            }
        }
        // do we have extra fields to expand
        if (count($this->config->getPointerExtraFields($type)) > 0) {
            $query['expand'] = implode(',', $this->config->getPointerExtraFields($type));
        }
        
        array_unique($fields);
        $query['fields'] = implode(",", $fields);

        if (Yii::$app->request->get('pool')) {
            $query['pool'] = Yii::$app->request->get('pool');
        }

        // return url decoded string from http_build_query
        return http_build_query($query, '', '&');
    }
public function apiQueryString ( $ type ) { // basic query $ query = [ 'ngrestCallType' => $ type ] ; $ fields = [ ] ; foreach ( $ this -> model -> primaryKey ( ) as $ n ) { $ fields [ ] = $ n ; } // see if we have fields for this type if ( count ( $ this -> getFields ( $ type ) ) > 0 ) { foreach ( $ this -> getFields ( $ type ) as $ field ) { $ fields [ ] = $ field ; } } // do we have extra fields to expand if ( count ( $ this -> config -> getPointerExtraFields ( $ type ) ) > 0 ) { $ query [ 'expand' ] = implode ( ',' , $ this -> config -> getPointerExtraFields ( $ type ) ) ; } array_unique ( $ fields ) ; $ query [ 'fields' ] = implode ( "," , $ fields ) ; if ( Yii :: $ app -> request -> get ( 'pool' ) ) { $ query [ 'pool' ] = Yii :: $ app -> request -> get ( 'pool' ) ; } // return url decoded string from http_build_query return http_build_query ( $ query , '' , '&' ) ; }
Generate the api query string for a certain context type

@param string $type
@return string
Generate the api query string for a certain context type