src/Utility/Export.php
protected function getRows(int $page, int $limit): array
    {
        $displayColumns = $this->getDisplayColumns();
        if (empty($displayColumns)) {
            return [];
        }

        $query = $this->query->page($page, $limit);
        $entities = $query->all();
        if ($entities->isEmpty()) {
            return [];
        }

        $table = TableRegistry::get($this->search->get('model'));

        $event = new Event((string)EventName::MODEL_SEARCH_AFTER_FIND(), $this, [
            'entities' => $entities,
            'table' => $table
        ]);
        EventManager::instance()->dispatch($event);
        if ($event->result) {
            $entities = $event->result;
        }

        $displayColumns = array_map('strval', $displayColumns);
        $entities = $entities ? Utility::instance()->toCsv($entities, $displayColumns, $table) : [];

        if (empty($entities)) {
            return [];
        }

        $result = [];
        foreach ($entities as $k => $entity) {
            $result[$k] = [];
            foreach ($displayColumns as $column) {
                $value = trim(strip_tags(html_entity_decode($entity[$column], ENT_QUOTES)), " \t\n\r\0\x0B\xC2\xA0");
                $result[$k][] = $value;
            }
        }

        return $result;
    }
protected function getRows(int $page, int $limit): array
    {
        $displayColumns = $this->getDisplayColumns();
        if (empty($displayColumns)) {
            return [];
        }

        $query = $this->query->page($page, $limit);
        $entities = $query->all();
        if ($entities->isEmpty()) {
            return [];
        }

        $table = TableRegistry::get($this->search->get('model'));

        $event = new Event((string)EventName::MODEL_SEARCH_AFTER_FIND(), $this, [
            'entities' => $entities,
            'table' => $table
        ]);
        EventManager::instance()->dispatch($event);
        if ($event->result) {
            $entities = $event->result;
        }

        $displayColumns = array_map('strval', $displayColumns);
        $entities = $entities ? Utility::instance()->toCsv($entities, $displayColumns, $table) : [];

        if (empty($entities)) {
            return [];
        }

        $result = [];
        foreach ($entities as $k => $entity) {
            $result[$k] = [];
            foreach ($displayColumns as $column) {
                $value = trim(strip_tags(html_entity_decode($entity[$column], ENT_QUOTES)), " \t\n\r\0\x0B\xC2\xA0");
                $result[$k][] = $value;
            }
        }

        return $result;
    }
protected function getRows ( int $ page , int $ limit ) : array { $ displayColumns = $ this -> getDisplayColumns ( ) ; if ( empty ( $ displayColumns ) ) { return [ ] ; } $ query = $ this -> query -> page ( $ page , $ limit ) ; $ entities = $ query -> all ( ) ; if ( $ entities -> isEmpty ( ) ) { return [ ] ; } $ table = TableRegistry :: get ( $ this -> search -> get ( 'model' ) ) ; $ event = new Event ( ( string ) EventName :: MODEL_SEARCH_AFTER_FIND ( ) , $ this , [ 'entities' => $ entities , 'table' => $ table ] ) ; EventManager :: instance ( ) -> dispatch ( $ event ) ; if ( $ event -> result ) { $ entities = $ event -> result ; } $ displayColumns = array_map ( 'strval' , $ displayColumns ) ; $ entities = $ entities ? Utility :: instance ( ) -> toCsv ( $ entities , $ displayColumns , $ table ) : [ ] ; if ( empty ( $ entities ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ entities as $ k => $ entity ) { $ result [ $ k ] = [ ] ; foreach ( $ displayColumns as $ column ) { $ value = trim ( strip_tags ( html_entity_decode ( $ entity [ $ column ] , ENT_QUOTES ) ) , " \t\n\r\0\x0B\xC2\xA0" ) ; $ result [ $ k ] [ ] = $ value ; } } return $ result ; }
Get export rows.

@param int $page Pagination page
@param int $limit Pagination limit
@return mixed[]
Get export rows .