public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $query = $this->buildQuery();

        // @deprecated Criteria
        // -- FullTextCriterion
        if (array_key_exists('Criteria', $data) && is_array($data['Criteria'])) {
            $message = 'The Criteria element is deprecated since ezpublish-kernel 6.6, and will be removed in 8.0. Use Filter instead, or Query for criteria that should affect scoring.';
            if (array_key_exists('Filter', $data) && is_array($data['Filter'])) {
                $message .= ' The Criteria element will be merged into Filter.';
                $data['Filter'] = array_merge($data['Filter'], $data['Criteria']);
            } else {
                $data['Filter'] = $data['Criteria'];
            }

            @trigger_error($message, E_USER_DEPRECATED);
        }

        if (array_key_exists('Filter', $data) && is_array($data['Filter'])) {
            $query->filter = $this->processCriteriaArray($data['Filter'], $parsingDispatcher);
        }

        if (array_key_exists('Query', $data) && is_array($data['Query'])) {
            $query->query = $this->processCriteriaArray($data['Query'], $parsingDispatcher);
        }

        // limit
        if (array_key_exists('limit', $data)) {
            $query->limit = (int)$data['limit'];
        }

        // offset
        if (array_key_exists('offset', $data)) {
            $query->offset = (int)$data['offset'];
        }

        // SortClauses
        // -- [SortClauseName: direction|data]
        if (array_key_exists('SortClauses', $data)) {
            $query->sortClauses = $this->processSortClauses($data['SortClauses'], $parsingDispatcher);
        }

        // FacetBuilders
        // -- facetBuilderListType
        if (array_key_exists('FacetBuilders', $data)) {
            $facetBuilders = [];
            foreach ($data['FacetBuilders'] as $facetBuilderName => $facetBuilderData) {
                $facetBuilders[] = $this->dispatchFacetBuilder($facetBuilderName, $facetBuilderData, $parsingDispatcher);
            }
            $query->facetBuilders = $facetBuilders;
        }

        return $query;
    }
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $query = $this->buildQuery();

        // @deprecated Criteria
        // -- FullTextCriterion
        if (array_key_exists('Criteria', $data) && is_array($data['Criteria'])) {
            $message = 'The Criteria element is deprecated since ezpublish-kernel 6.6, and will be removed in 8.0. Use Filter instead, or Query for criteria that should affect scoring.';
            if (array_key_exists('Filter', $data) && is_array($data['Filter'])) {
                $message .= ' The Criteria element will be merged into Filter.';
                $data['Filter'] = array_merge($data['Filter'], $data['Criteria']);
            } else {
                $data['Filter'] = $data['Criteria'];
            }

            @trigger_error($message, E_USER_DEPRECATED);
        }

        if (array_key_exists('Filter', $data) && is_array($data['Filter'])) {
            $query->filter = $this->processCriteriaArray($data['Filter'], $parsingDispatcher);
        }

        if (array_key_exists('Query', $data) && is_array($data['Query'])) {
            $query->query = $this->processCriteriaArray($data['Query'], $parsingDispatcher);
        }

        // limit
        if (array_key_exists('limit', $data)) {
            $query->limit = (int)$data['limit'];
        }

        // offset
        if (array_key_exists('offset', $data)) {
            $query->offset = (int)$data['offset'];
        }

        // SortClauses
        // -- [SortClauseName: direction|data]
        if (array_key_exists('SortClauses', $data)) {
            $query->sortClauses = $this->processSortClauses($data['SortClauses'], $parsingDispatcher);
        }

        // FacetBuilders
        // -- facetBuilderListType
        if (array_key_exists('FacetBuilders', $data)) {
            $facetBuilders = [];
            foreach ($data['FacetBuilders'] as $facetBuilderName => $facetBuilderData) {
                $facetBuilders[] = $this->dispatchFacetBuilder($facetBuilderName, $facetBuilderData, $parsingDispatcher);
            }
            $query->facetBuilders = $facetBuilders;
        }

        return $query;
    }
public function parse ( array $ data , ParsingDispatcher $ parsingDispatcher ) { $ query = $ this -> buildQuery ( ) ; // @deprecated Criteria // -- FullTextCriterion if ( array_key_exists ( 'Criteria' , $ data ) && is_array ( $ data [ 'Criteria' ] ) ) { $ message = 'The Criteria element is deprecated since ezpublish-kernel 6.6, and will be removed in 8.0. Use Filter instead, or Query for criteria that should affect scoring.' ; if ( array_key_exists ( 'Filter' , $ data ) && is_array ( $ data [ 'Filter' ] ) ) { $ message .= ' The Criteria element will be merged into Filter.' ; $ data [ 'Filter' ] = array_merge ( $ data [ 'Filter' ] , $ data [ 'Criteria' ] ) ; } else { $ data [ 'Filter' ] = $ data [ 'Criteria' ] ; } @ trigger_error ( $ message , E_USER_DEPRECATED ) ; } if ( array_key_exists ( 'Filter' , $ data ) && is_array ( $ data [ 'Filter' ] ) ) { $ query -> filter = $ this -> processCriteriaArray ( $ data [ 'Filter' ] , $ parsingDispatcher ) ; } if ( array_key_exists ( 'Query' , $ data ) && is_array ( $ data [ 'Query' ] ) ) { $ query -> query = $ this -> processCriteriaArray ( $ data [ 'Query' ] , $ parsingDispatcher ) ; } // limit if ( array_key_exists ( 'limit' , $ data ) ) { $ query -> limit = ( int ) $ data [ 'limit' ] ; } // offset if ( array_key_exists ( 'offset' , $ data ) ) { $ query -> offset = ( int ) $ data [ 'offset' ] ; } // SortClauses // -- [SortClauseName: direction|data] if ( array_key_exists ( 'SortClauses' , $ data ) ) { $ query -> sortClauses = $ this -> processSortClauses ( $ data [ 'SortClauses' ] , $ parsingDispatcher ) ; } // FacetBuilders // -- facetBuilderListType if ( array_key_exists ( 'FacetBuilders' , $ data ) ) { $ facetBuilders = [ ] ; foreach ( $ data [ 'FacetBuilders' ] as $ facetBuilderName => $ facetBuilderData ) { $ facetBuilders [ ] = $ this -> dispatchFacetBuilder ( $ facetBuilderName , $ facetBuilderData , $ parsingDispatcher ) ; } $ query -> facetBuilders = $ facetBuilders ; } return $ query ; }
Parses input structure to a Query.

@param array $data
@param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher

@throws \eZ\Publish\Core\REST\Common\Exceptions\Parser

@return \eZ\Publish\API\Repository\Values\Content\Query
Parses input structure to a Query .