public function buildSordOrders(ContainerConfigurationInterface $containerConfig, array $orders)
    {
        $sortOrders = [];
        $mapping    = $containerConfig->getMapping();

        $orders = $this->addDefaultSortOrders($orders, $mapping);

        foreach ($orders as $fieldName => $sortOrderParams) {
            $factory = $this->standardOrderFactory;

            try {
                $sortField       = $mapping->getField($fieldName);
                $sortOrderParams = $this->getSortOrderParams($sortField, $sortOrderParams);

                if (isset($sortOrderParams['nestedPath'])) {
                    $factory = $this->nestedOrderFactory;
                }

                if (isset($sortOrderParams['nestedFilter'])) {
                    $nestedFilter = $this->queryBuilder->create(
                        $containerConfig,
                        $sortOrderParams['nestedFilter'],
                        $sortOrderParams['nestedPath']
                    );
                    $sortOrderParams['nestedFilter'] = $nestedFilter;
                }
            } catch (\LogicException $e) {
                $sortOrderParams['field'] = $fieldName;
            }

            $sortOrders[] = $factory->create($sortOrderParams);
        }

        return $sortOrders;
    }
public function buildSordOrders(ContainerConfigurationInterface $containerConfig, array $orders)
    {
        $sortOrders = [];
        $mapping    = $containerConfig->getMapping();

        $orders = $this->addDefaultSortOrders($orders, $mapping);

        foreach ($orders as $fieldName => $sortOrderParams) {
            $factory = $this->standardOrderFactory;

            try {
                $sortField       = $mapping->getField($fieldName);
                $sortOrderParams = $this->getSortOrderParams($sortField, $sortOrderParams);

                if (isset($sortOrderParams['nestedPath'])) {
                    $factory = $this->nestedOrderFactory;
                }

                if (isset($sortOrderParams['nestedFilter'])) {
                    $nestedFilter = $this->queryBuilder->create(
                        $containerConfig,
                        $sortOrderParams['nestedFilter'],
                        $sortOrderParams['nestedPath']
                    );
                    $sortOrderParams['nestedFilter'] = $nestedFilter;
                }
            } catch (\LogicException $e) {
                $sortOrderParams['field'] = $fieldName;
            }

            $sortOrders[] = $factory->create($sortOrderParams);
        }

        return $sortOrders;
    }
public function buildSordOrders ( ContainerConfigurationInterface $ containerConfig , array $ orders ) { $ sortOrders = [ ] ; $ mapping = $ containerConfig -> getMapping ( ) ; $ orders = $ this -> addDefaultSortOrders ( $ orders , $ mapping ) ; foreach ( $ orders as $ fieldName => $ sortOrderParams ) { $ factory = $ this -> standardOrderFactory ; try { $ sortField = $ mapping -> getField ( $ fieldName ) ; $ sortOrderParams = $ this -> getSortOrderParams ( $ sortField , $ sortOrderParams ) ; if ( isset ( $ sortOrderParams [ 'nestedPath' ] ) ) { $ factory = $ this -> nestedOrderFactory ; } if ( isset ( $ sortOrderParams [ 'nestedFilter' ] ) ) { $ nestedFilter = $ this -> queryBuilder -> create ( $ containerConfig , $ sortOrderParams [ 'nestedFilter' ] , $ sortOrderParams [ 'nestedPath' ] ) ; $ sortOrderParams [ 'nestedFilter' ] = $ nestedFilter ; } } catch ( \ LogicException $ e ) { $ sortOrderParams [ 'field' ] = $ fieldName ; } $ sortOrders [ ] = $ factory -> create ( $ sortOrderParams ) ; } return $ sortOrders ; }
Build sort orders from array of sort orders definition.

@param ContainerConfigurationInterface $containerConfig Request configuration.
@param array                           $orders          Sort orders definitions.

@return SortOrderInterface[]
Build sort orders from array of sort orders definition .