public function create(ContainerConfigurationInterface $containerConfig, array $filters, $currentPath = null)
    {
        $queries = [];

        $mapping = $containerConfig->getMapping();

        foreach ($filters as $fieldName => $condition) {
            if ($condition instanceof QueryInterface) {
                $queries[] = $condition;
            } else {
                $mappingField = $mapping->getField($fieldName);
                $queries[]    = $this->prepareFieldCondition($mappingField, $condition, $currentPath);
            }
        }

        $filterQuery = current($queries);

        if (count($queries) > 1) {
            $filterQuery = $this->queryFactory->create(QueryInterface::TYPE_BOOL, ['must' => $queries]);
        }

        return $filterQuery;
    }
public function create(ContainerConfigurationInterface $containerConfig, array $filters, $currentPath = null)
    {
        $queries = [];

        $mapping = $containerConfig->getMapping();

        foreach ($filters as $fieldName => $condition) {
            if ($condition instanceof QueryInterface) {
                $queries[] = $condition;
            } else {
                $mappingField = $mapping->getField($fieldName);
                $queries[]    = $this->prepareFieldCondition($mappingField, $condition, $currentPath);
            }
        }

        $filterQuery = current($queries);

        if (count($queries) > 1) {
            $filterQuery = $this->queryFactory->create(QueryInterface::TYPE_BOOL, ['must' => $queries]);
        }

        return $filterQuery;
    }
public function create ( ContainerConfigurationInterface $ containerConfig , array $ filters , $ currentPath = null ) { $ queries = [ ] ; $ mapping = $ containerConfig -> getMapping ( ) ; foreach ( $ filters as $ fieldName => $ condition ) { if ( $ condition instanceof QueryInterface ) { $ queries [ ] = $ condition ; } else { $ mappingField = $ mapping -> getField ( $ fieldName ) ; $ queries [ ] = $ this -> prepareFieldCondition ( $ mappingField , $ condition , $ currentPath ) ; } } $ filterQuery = current ( $ queries ) ; if ( count ( $ queries ) > 1 ) { $ filterQuery = $ this -> queryFactory -> create ( QueryInterface :: TYPE_BOOL , [ 'must' => $ queries ] ) ; } return $ filterQuery ; }
Prepare filter condition from an array as used into addFieldToFilter.

@SuppressWarnings(PHPMD.ElseExpression)

@param ContainerConfigurationInterface $containerConfig Search request container configuration.
@param array                           $filters         Filters to be built.
@param string|null                     $currentPath     Current nested path or null.

@return QueryInterface
Prepare filter condition from an array as used into addFieldToFilter .