public function execute()
    {
        $data = $this->getData();

        /*
         * Step 1) Apply sorting
         *
         * @see http://php.net/manual/de/function.array-multisort.php
         * @see example number 3
         */
        if (!empty($this->getSortConditions())) {
            $data = $this->sortArrayMultiple($data, $this->getSortConditions());
        }

        /*
         * Step 2) Apply filters
         */
        foreach ($this->getFilters() as $filter) {
            /* @var $filter \ZfcDatagrid\Filter */
            if ($filter->isColumnFilter() === true) {
                $data = array_filter($data, [
                    new PhpArray\Filter($filter),
                    'applyFilter',
                ]);
            }
        }

        /**
         * Step 3) Remove unneeded columns.
         *
         * @todo ? Better performance or let it be?
         */
        $selectedColumns = [];
        foreach ($this->getColumns() as $col) {
            if (! $col instanceof Column\Select) {
                continue;
            }

            $colString = $col->getSelectPart1();
            if ($col->getSelectPart2() != '') {
                $colString = $col->getSelectPart1().'_'.$col->getSelectPart2();
            }

            $selectedColumns[] = $colString;
        }

        foreach ($data as &$row) {
            foreach ($row as $keyRowCol => $rowCol) {
                if (! in_array($keyRowCol, $selectedColumns)) {
                    unset($row[$keyRowCol]);
                }
            }
        }

        /*
         * Step 4) Pagination
         */
        $this->setPaginatorAdapter(new PaginatorAdapter($data));
    }
public function execute()
    {
        $data = $this->getData();

        /*
         * Step 1) Apply sorting
         *
         * @see http://php.net/manual/de/function.array-multisort.php
         * @see example number 3
         */
        if (!empty($this->getSortConditions())) {
            $data = $this->sortArrayMultiple($data, $this->getSortConditions());
        }

        /*
         * Step 2) Apply filters
         */
        foreach ($this->getFilters() as $filter) {
            /* @var $filter \ZfcDatagrid\Filter */
            if ($filter->isColumnFilter() === true) {
                $data = array_filter($data, [
                    new PhpArray\Filter($filter),
                    'applyFilter',
                ]);
            }
        }

        /**
         * Step 3) Remove unneeded columns.
         *
         * @todo ? Better performance or let it be?
         */
        $selectedColumns = [];
        foreach ($this->getColumns() as $col) {
            if (! $col instanceof Column\Select) {
                continue;
            }

            $colString = $col->getSelectPart1();
            if ($col->getSelectPart2() != '') {
                $colString = $col->getSelectPart1().'_'.$col->getSelectPart2();
            }

            $selectedColumns[] = $colString;
        }

        foreach ($data as &$row) {
            foreach ($row as $keyRowCol => $rowCol) {
                if (! in_array($keyRowCol, $selectedColumns)) {
                    unset($row[$keyRowCol]);
                }
            }
        }

        /*
         * Step 4) Pagination
         */
        $this->setPaginatorAdapter(new PaginatorAdapter($data));
    }
public function execute ( ) { $ data = $ this -> getData ( ) ; /*
         * Step 1) Apply sorting
         *
         * @see http://php.net/manual/de/function.array-multisort.php
         * @see example number 3
         */ if ( ! empty ( $ this -> getSortConditions ( ) ) ) { $ data = $ this -> sortArrayMultiple ( $ data , $ this -> getSortConditions ( ) ) ; } /*
         * Step 2) Apply filters
         */ foreach ( $ this -> getFilters ( ) as $ filter ) { /* @var $filter \ZfcDatagrid\Filter */ if ( $ filter -> isColumnFilter ( ) === true ) { $ data = array_filter ( $ data , [ new PhpArray \ Filter ( $ filter ) , 'applyFilter' , ] ) ; } } /**
         * Step 3) Remove unneeded columns.
         *
         * @todo ? Better performance or let it be?
         */ $ selectedColumns = [ ] ; foreach ( $ this -> getColumns ( ) as $ col ) { if ( ! $ col instanceof Column \ Select ) { continue ; } $ colString = $ col -> getSelectPart1 ( ) ; if ( $ col -> getSelectPart2 ( ) != '' ) { $ colString = $ col -> getSelectPart1 ( ) . '_' . $ col -> getSelectPart2 ( ) ; } $ selectedColumns [ ] = $ colString ; } foreach ( $ data as & $ row ) { foreach ( $ row as $ keyRowCol => $ rowCol ) { if ( ! in_array ( $ keyRowCol , $ selectedColumns ) ) { unset ( $ row [ $ keyRowCol ] ) ; } } } /*
         * Step 4) Pagination
         */ $ this -> setPaginatorAdapter ( new PaginatorAdapter ( $ data ) ) ; }
Execute the query and set the paginator
- with sort statements
- with filters statements.
Execute the query and set the paginator - with sort statements - with filters statements .