Export by ID's

@param array $rows
@return array
@internal param array $features
@internal param array $ids
772083
public function export(array &$rows)
    {
        $config     = $this->getConfiguration('export');
        $fieldNames = isset($config['fields']) ? $config['fields'] : null;
        $result     = array();

        if ($fieldNames) {
            foreach ($rows as &$row) {
                $exportRow = array();
                foreach ($fieldNames as $fieldName => $fieldCode) {
                    $exportRow[ $fieldName ] = $this->evaluateField($row, $fieldCode);
                }
                $result[] = $exportRow;
            }
        } else {
            $result = &$rows;
        }

        return $result;
    }
777014
public function populate($rows)
    {
        $indexBy = $this->indexBy;

        if ($indexBy === null) {
            return $this->createObjects($rows);
        }
        $result = [];
        foreach ($rows as $row) {
            if (is_string($indexBy)) {
                $key = $row[$indexBy];
            } else {
                $key = call_user_func($indexBy, $row);
            }
            $result[$key] = $this->createObject($row);
        }
        return $result;
    }
349471
public function extractUrlAliasListFromData(array $rows)
    {
        $urlAliases = array();
        foreach ($rows as $row) {
            $urlAliases[] = $this->extractUrlAliasFromData($row);
        }

        return $urlAliases;
    }
1210970
public function table(array $rows, array $styles = []): self
    {
        if ([] === $table = $this->normalizeTable($rows)) {
            return $this;
        }

        list($head, $rows) = $table;

        $styles = $this->normalizeStyles($styles);
        $title  = $body = $dash = [];

        list($start, $end) = $styles['head'];
        foreach ($head as $col => $size) {
            $dash[]  = \str_repeat('-', $size + 2);
            $title[] = \str_pad($this->toWords($col), $size, ' ');
        }

        $title = "|$start " . \implode(" $end|$start ", $title) . " $end|" . \PHP_EOL;

        $odd = true;
        foreach ($rows as $row) {
            $parts = [];

            list($start, $end) = $styles[['even', 'odd'][(int) $odd]];
            foreach ($head as $col => $size) {
                $parts[] = \str_pad($row[$col] ?? '', $size, ' ');
            }

            $odd    = !$odd;
            $body[] = "|$start " . \implode(" $end|$start ", $parts) . " $end|";
        }

        $dash  = '+' . \implode('+', $dash) . '+' . \PHP_EOL;
        $body  = \implode(\PHP_EOL, $body) . \PHP_EOL;

        return $this->colors("$dash$title$dash$body$dash");
    }
261302
protected function groupRowDataBySuppliedColumns(array $rows) : array
    {
        $groups = [];

        foreach ($rows as $row) {
            $columnNames = array_keys($row);
            sort($columnNames, SORT_STRING);
            $key = implode('||', $columnNames);

            $groups[$key][] = $row;
        }

        return $groups;
    }
23375
public function export($filename, $rows)
    {
        $delimiter     = $this->config->getDelimiter();
        $enclosure     = $this->config->getEnclosure();
        $enclosure     = empty($enclosure) ? "\0" : $enclosure;
        $newline       = $this->config->getNewline();
        $fromCharset   = $this->config->getFromCharset();
        $toCharset     = $this->config->getToCharset();
        $fileMode      = $this->config->getFileMode();
        $columnHeaders = $this->config->getColumnHeaders();

        try {
            $csv = new CsvFileObject($filename, $fileMode);
        } catch ( \Exception $e ) {
            throw new IOException($e->getMessage(), null, $e);
        }

        $csv->setNewline($newline);

        if ( $toCharset ) {
            $csv->setCsvFilter(function($line) use($toCharset, $fromCharset) {
                return mb_convert_encoding($line, $toCharset, $fromCharset);
            });
        }

        if (count($columnHeaders) > 0) {
            $this->checkRowConsistency($columnHeaders);
            $csv->fputcsv($columnHeaders, $delimiter, $enclosure);
        }

        foreach ( $rows as $row ) {
            $this->checkRowConsistency($row);
            $csv->fputcsv($row, $delimiter, $enclosure);
        }
        $csv->fflush();
    }
1131771
public function replaceRows(array $rows): array
    {
        if (null === $this->data) {
            $this->buildIndex();
        }

        $list = [];
        foreach ($rows as $key => $row) {
            if (strpos($key, '@@')) {
                $key = $this->getNewKey();
            }
            $this->data[$key] = $list[$key] = $row;
        }

        if ($list) {
            $this->save();
        }

        return $list;
    }
239489
public static function createFromArray(array $rows)
    {
        $matrix = new Matrix();

        foreach ($rows as $offset => $row) {
            $matrix->setRow($offset, Row::createFromArray($row));
        }

        return $matrix;
    }
548469
public function createRows(array $rows): array
    {
        $list = [];
        foreach ($rows as $key => $row) {
            // Create new file and save it.
            $key = $this->getNewKey();
            $path = $this->getPathFromKey($key);
            $file = $this->getFile($path);
            $list[$key] = $this->saveFile($file, $row);
        }

        return $list;
    }
1138389
private function copyRow($rows, $line)
    {
        $row = $rows[$line];
        foreach ($row as $cellKey => $cellValue) {
            $row[$cellKey] = '';
            if ($cellValue instanceof TableCell) {
                $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
            }
        }

        return $row;
    }
818924
public function setRows(array $rows)
    {
        $this->rows = $rows;
        $this->setKeys(array_keys($this->rows[0]));
        return $this;
    }
992157
protected function getColumns( $rows ) {

        $columns = array();

        foreach ( $rows as $row ) {

            foreach ( $row as $column => $value ) {

                $columns[ $column ] = true;

            }

        }

        return array_keys( $columns );

    }
913120
private function sanitize(array $rows)
    {
        $_documentClass = $this->_documentClass;

        if (isset($this->_options[self::ENTRY_SANITIZE]) && $this->_options[self::ENTRY_SANITIZE]) {
            foreach ($rows as $key => $value) {

                if (is_array($value) && isset($value[$_documentClass::ENTRY_ID])) {
                    unset($rows[$key][$_documentClass::ENTRY_ID]);
                }

                if (is_array($value) && isset($value[$_documentClass::ENTRY_REV])) {
                    unset($rows[$key][$_documentClass::ENTRY_REV]);
                }
            }
        }

        return $rows;
    }
433319
public function mapModels($rows){
        $rst = array();
        foreach($rows as $row){
            $rst[] = $this->map($row);
        }
        
        return $rst;
    }
551446
protected function createObjects($rows)
    {
        $models = [];

        foreach ($rows as $key => $row) {
            $models[$key] = $this->createObject($row);
        }

        return $models;
    }
377831
public function deleteByIdArray(array $ids)
    {
        $data['ids'] = $ids;

        $deleteResult = $this->getRequest()->request(
            'DELETE',
            $this->getRequestUrl('inputs'),
            $data
        );

        return $deleteResult['status'];
    }
905490
public function export(string $id, array $data, array $headers = [])
    {
        $url = $this->url('payment_sources/%s/export_payment_source', $id);

        return $this->post($url, $data, $headers);
    }