Command/ExportIndexCommand.php
public static function exportToFile(
        string $file,
        OutputInterface $output,
        callable $queryItems
    ) {
        $resource = fopen($file, 'w');

        $i = 1;
        $count = 0;
        while (true) {
            $items = $queryItems(Query::create('', $i, 500))->getItems();

            if (empty($items)) {
                break;
            }

            self::writeItemsToResource(
                $resource,
                $items
            );
            self::printPartialCountSaved($output, count($items));

            $count += count($items);
            ++$i;
        }

        fclose($resource);

        return $count;
    }
public static function exportToFile(
        string $file,
        OutputInterface $output,
        callable $queryItems
    ) {
        $resource = fopen($file, 'w');

        $i = 1;
        $count = 0;
        while (true) {
            $items = $queryItems(Query::create('', $i, 500))->getItems();

            if (empty($items)) {
                break;
            }

            self::writeItemsToResource(
                $resource,
                $items
            );
            self::printPartialCountSaved($output, count($items));

            $count += count($items);
            ++$i;
        }

        fclose($resource);

        return $count;
    }
public static function exportToFile ( string $ file , OutputInterface $ output , callable $ queryItems ) { $ resource = fopen ( $ file , 'w' ) ; $ i = 1 ; $ count = 0 ; while ( true ) { $ items = $ queryItems ( Query :: create ( '' , $ i , 500 ) ) -> getItems ( ) ; if ( empty ( $ items ) ) { break ; } self :: writeItemsToResource ( $ resource , $ items ) ; self :: printPartialCountSaved ( $ output , count ( $ items ) ) ; $ count += count ( $ items ) ; ++ $ i ; } fclose ( $ resource ) ; return $ count ; }
Save items and return total imported.

@param string          $file
@param OutputInterface $output
@param callable        $queryItems

@return int
Save items and return total imported .