src/Adapter/CsvExportAdapter.php
/**
     * Imports the content of the CSV file with the passed filename.
     *
     * @param array   $artefacts The artefacts to be exported
     * @param string  $targetDir The target dir to export the artefacts to
     * @param integer $timestamp The timestamp part of the original import file
     * @param string  $counter   The counter part of the origin import file
     *
     * @return void
     */
Imports the content of the CSV file with the passed filename.
@param array   $artefacts The artefacts to be exported
@param string  $targetDir The target dir to export the artefacts to
@param integer $timestamp The timestamp part of the original import file
@param string  $counter   The counter part of the origin import file

@return void
Imports the content of the CSV file with the passed filename . @param array $artefacts The artefacts to be exported @param string $targetDir The target dir to export the artefacts to @param integer $timestamp The timestamp part of the original import file @param string $counter The counter part of the origin import file @return void
public function export(array $artefacts, $targetDir, $timestamp, $counter)
    {
        $this->exportedFilenames = array();
        foreach ($artefacts as $artefactType => $artefacts) {
            $bunch = array();
            foreach ($artefacts as $entityArtefacts) {
                if (sizeof($bunch) === 0) {
                    $bunch[] = array_keys(reset($entityArtefacts));
                }
                foreach ($entityArtefacts as $entityArtefact) {
                    array_push($bunch, $entityArtefact);
                }
            }
            $filename = sprintf(
                '%s/%s_%s_%s.csv',
                $targetDir,
                $artefactType,
                $timestamp,
                $counter
            );
            $this->exporter->export($filename, $bunch);
            $this->exportedFilenames[] = $filename;
        }
    }
public function export ( array $ artefacts , $ targetDir , $ timestamp , $ counter ) { $ this -> exportedFilenames = array ( ) ; foreach ( $ artefacts as $ artefactType => $ artefacts ) { $ bunch = array ( ) ; foreach ( $ artefacts as $ entityArtefacts ) { if ( sizeof ( $ bunch ) === 0 ) { $ bunch [ ] = array_keys ( reset ( $ entityArtefacts ) ) ; } foreach ( $ entityArtefacts as $ entityArtefact ) { array_push ( $ bunch , $ entityArtefact ) ; } } $ filename = sprintf ( '%s/%s_%s_%s.csv' , $ targetDir , $ artefactType , $ timestamp , $ counter ) ; $ this -> exporter -> export ( $ filename , $ bunch ) ; $ this -> exportedFilenames [ ] = $ filename ; } }
Imports the content of the CSV file with the passed filename.
Imports the content of the CSV file with the passed filename .
// reset the array with the exported filename // iterate over the artefacts and export them // initialize the bunch and the exporter // iterate over the artefact types artefacts // prepend the bunch header first // export the artefacts // prepare the name of the export file // export the artefact (bunch) // add the filename to the array with the exported filenames