public function applySelect(SelectQuery $query, array $sortClauses)
    {
        foreach ($sortClauses as $nr => $sortClause) {
            foreach ($this->handlers as $handler) {
                if ($handler->accept($sortClause)) {
                    foreach ((array)$handler->applySelect($query, $sortClause, $nr) as $column) {
                        if (strrpos($column, '_null', -6) === false) {
                            $direction = $sortClause->direction;
                        } else {
                            // Always sort null last
                            $direction = SelectQuery::ASC;
                        }

                        $this->sortColumns[$column] = $direction;
                    }
                    continue 2;
                }
            }

            throw new RuntimeException('No handler available for sort clause: ' . get_class($sortClause));
        }
    }
public function applySelect(SelectQuery $query, array $sortClauses)
    {
        foreach ($sortClauses as $nr => $sortClause) {
            foreach ($this->handlers as $handler) {
                if ($handler->accept($sortClause)) {
                    foreach ((array)$handler->applySelect($query, $sortClause, $nr) as $column) {
                        if (strrpos($column, '_null', -6) === false) {
                            $direction = $sortClause->direction;
                        } else {
                            // Always sort null last
                            $direction = SelectQuery::ASC;
                        }

                        $this->sortColumns[$column] = $direction;
                    }
                    continue 2;
                }
            }

            throw new RuntimeException('No handler available for sort clause: ' . get_class($sortClause));
        }
    }
public function applySelect ( SelectQuery $ query , array $ sortClauses ) { foreach ( $ sortClauses as $ nr => $ sortClause ) { foreach ( $ this -> handlers as $ handler ) { if ( $ handler -> accept ( $ sortClause ) ) { foreach ( ( array ) $ handler -> applySelect ( $ query , $ sortClause , $ nr ) as $ column ) { if ( strrpos ( $ column , '_null' , - 6 ) === false ) { $ direction = $ sortClause -> direction ; } else { // Always sort null last $ direction = SelectQuery :: ASC ; } $ this -> sortColumns [ $ column ] = $ direction ; } continue 2 ; } } throw new RuntimeException ( 'No handler available for sort clause: ' . get_class ( $ sortClause ) ) ; } }
Apply select parts of sort clauses to query.

@throws \RuntimeException If no handler is available for sort clause

@param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
@param \eZ\Publish\API\Repository\Values\Content\Query\SortClause[] $sortClauses
Apply select parts of sort clauses to query .