Command/ExportIndexCommand.php
private static function writeItemsToResource(
        $resource,
        array $items
    ) {
        foreach ($items as $item) {
            fputcsv($resource, [
                $item->getId(),
                $item->getType(),
                json_encode($item->getMetadata()),
                json_encode($item->getIndexedMetadata()),
                json_encode($item->getSearchableMetadata()),
                json_encode($item->getExactMatchingMetadata()),
                json_encode($item->getSuggest()),
                json_encode(
                    ($item->getCoordinate() instanceof Coordinate)
                        ? $item->getCoordinate()->toArray()
                        : null
                ),
            ]);
        }
    }
private static function writeItemsToResource(
        $resource,
        array $items
    ) {
        foreach ($items as $item) {
            fputcsv($resource, [
                $item->getId(),
                $item->getType(),
                json_encode($item->getMetadata()),
                json_encode($item->getIndexedMetadata()),
                json_encode($item->getSearchableMetadata()),
                json_encode($item->getExactMatchingMetadata()),
                json_encode($item->getSuggest()),
                json_encode(
                    ($item->getCoordinate() instanceof Coordinate)
                        ? $item->getCoordinate()->toArray()
                        : null
                ),
            ]);
        }
    }
private static function writeItemsToResource ( $ resource , array $ items ) { foreach ( $ items as $ item ) { fputcsv ( $ resource , [ $ item -> getId ( ) , $ item -> getType ( ) , json_encode ( $ item -> getMetadata ( ) ) , json_encode ( $ item -> getIndexedMetadata ( ) ) , json_encode ( $ item -> getSearchableMetadata ( ) ) , json_encode ( $ item -> getExactMatchingMetadata ( ) ) , json_encode ( $ item -> getSuggest ( ) ) , json_encode ( ( $ item -> getCoordinate ( ) instanceof Coordinate ) ? $ item -> getCoordinate ( ) -> toArray ( ) : null ) , ] ) ; } }
Echo items as CSV.

@param resource $resource
@param Item[]   $items
Echo items as CSV .