public function setSortColumns(array $columns)
    {
        $this->sortColumns = [];
        $this->mappingSortColumns = [];

        foreach ($columns as $i => $column) {
            if (!isset($column['name'])) {
                throw new InvalidArgumentException('The "name" property of sort column must be present ("sort" property is optional)');
            }

            if (isset($column['sort']) && 'asc' !== $column['sort'] && 'desc' !== $column['sort']) {
                throw new InvalidArgumentException('The "sort" property of sort column must have "asc" or "desc" value');
            }

            if ($this->isSorted($column['name'])) {
                throw new InvalidArgumentException(sprintf('The "%s" column is already sorted', $column['name']));
            }

            $this->sortColumns[] = $column;
            $this->mappingSortColumns[$column['name']] = $i;
        }

        return $this;
    }
public function setSortColumns(array $columns)
    {
        $this->sortColumns = [];
        $this->mappingSortColumns = [];

        foreach ($columns as $i => $column) {
            if (!isset($column['name'])) {
                throw new InvalidArgumentException('The "name" property of sort column must be present ("sort" property is optional)');
            }

            if (isset($column['sort']) && 'asc' !== $column['sort'] && 'desc' !== $column['sort']) {
                throw new InvalidArgumentException('The "sort" property of sort column must have "asc" or "desc" value');
            }

            if ($this->isSorted($column['name'])) {
                throw new InvalidArgumentException(sprintf('The "%s" column is already sorted', $column['name']));
            }

            $this->sortColumns[] = $column;
            $this->mappingSortColumns[$column['name']] = $i;
        }

        return $this;
    }
public function setSortColumns ( array $ columns ) { $ this -> sortColumns = [ ] ; $ this -> mappingSortColumns = [ ] ; foreach ( $ columns as $ i => $ column ) { if ( ! isset ( $ column [ 'name' ] ) ) { throw new InvalidArgumentException ( 'The "name" property of sort column must be present ("sort" property is optional)' ) ; } if ( isset ( $ column [ 'sort' ] ) && 'asc' !== $ column [ 'sort' ] && 'desc' !== $ column [ 'sort' ] ) { throw new InvalidArgumentException ( 'The "sort" property of sort column must have "asc" or "desc" value' ) ; } if ( $ this -> isSorted ( $ column [ 'name' ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The "%s" column is already sorted' , $ column [ 'name' ] ) ) ; } $ this -> sortColumns [ ] = $ column ; $ this -> mappingSortColumns [ $ column [ 'name' ] ] = $ i ; } return $ this ; }
Set sort columns.

@param array $columns

@return self
Set sort columns .