public function getResponse(
        $result, 
        $formatterData, 
        $exportAlias, 
        array $exportData, 
        array $filtersData, 
        array $aggregatorsData
    ) {
        $this->result = $result;
        $this->exportAlias = $exportAlias;
        $this->exportData = $exportData;
        $this->formatterData = $formatterData;
        
        $output = fopen('php://output', 'w');
        
        $this->prepareHeaders($output);
        
        $i = 1;
        foreach ($result as $row) {
            $line = array();
            
            if ($this->formatterData['numerotation'] === true) {
                $line[] = $i;
            }
            
            foreach ($row as $key => $value) {
                $line[] = $this->getLabel($key, $value);
            }
            
            fputcsv($output, $line);
            
            $i++;
        }
        
        $csvContent = stream_get_contents($output);
        fclose($output);
        
        $response = new Response();
        $response->setStatusCode(200);
        $response->headers->set('Content-Type', 'text/csv; charset=utf-8');
        //$response->headers->set('Content-Disposition','attachment; filename="export.csv"');

        $response->setContent($csvContent);
        
        return $response;
    }
public function getResponse(
        $result, 
        $formatterData, 
        $exportAlias, 
        array $exportData, 
        array $filtersData, 
        array $aggregatorsData
    ) {
        $this->result = $result;
        $this->exportAlias = $exportAlias;
        $this->exportData = $exportData;
        $this->formatterData = $formatterData;
        
        $output = fopen('php://output', 'w');
        
        $this->prepareHeaders($output);
        
        $i = 1;
        foreach ($result as $row) {
            $line = array();
            
            if ($this->formatterData['numerotation'] === true) {
                $line[] = $i;
            }
            
            foreach ($row as $key => $value) {
                $line[] = $this->getLabel($key, $value);
            }
            
            fputcsv($output, $line);
            
            $i++;
        }
        
        $csvContent = stream_get_contents($output);
        fclose($output);
        
        $response = new Response();
        $response->setStatusCode(200);
        $response->headers->set('Content-Type', 'text/csv; charset=utf-8');
        //$response->headers->set('Content-Disposition','attachment; filename="export.csv"');

        $response->setContent($csvContent);
        
        return $response;
    }
public function getResponse ( $ result , $ formatterData , $ exportAlias , array $ exportData , array $ filtersData , array $ aggregatorsData ) { $ this -> result = $ result ; $ this -> exportAlias = $ exportAlias ; $ this -> exportData = $ exportData ; $ this -> formatterData = $ formatterData ; $ output = fopen ( 'php://output' , 'w' ) ; $ this -> prepareHeaders ( $ output ) ; $ i = 1 ; foreach ( $ result as $ row ) { $ line = array ( ) ; if ( $ this -> formatterData [ 'numerotation' ] === true ) { $ line [ ] = $ i ; } foreach ( $ row as $ key => $ value ) { $ line [ ] = $ this -> getLabel ( $ key , $ value ) ; } fputcsv ( $ output , $ line ) ; $ i ++ ; } $ csvContent = stream_get_contents ( $ output ) ; fclose ( $ output ) ; $ response = new Response ( ) ; $ response -> setStatusCode ( 200 ) ; $ response -> headers -> set ( 'Content-Type' , 'text/csv; charset=utf-8' ) ; //$response->headers->set('Content-Disposition','attachment; filename="export.csv"'); $ response -> setContent ( $ csvContent ) ; return $ response ; }
Generate a response from the data collected on differents ExportElementInterface

@param mixed[] $result The result, as given by the ExportInterface
@param mixed[] $formatterData collected from the current form
@param string $exportAlias the id of the current export
@param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data
@param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
@return \Symfony\Component\HttpFoundation\Response The response to be shown
Generate a response from the data collected on differents ExportElementInterface