mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
add a hack to export on CSV
Currently, it seems that using the function fputcsv make PHP consider that header were sent. We have to send headers explicitly from the Controller.
This commit is contained in:
parent
2b4aec4b1a
commit
dc98fd9d86
@ -389,6 +389,7 @@ class ExportController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function generateAction(Request $request, $alias)
|
public function generateAction(Request $request, $alias)
|
||||||
{
|
{
|
||||||
|
/* @var $exportManager \Chill\MainBundle\Export\ExportManager */
|
||||||
$exportManager = $this->get('chill.main.export_manager');
|
$exportManager = $this->get('chill.main.export_manager');
|
||||||
|
|
||||||
$formCenters = $this->createCreateFormExport($alias, 'generate_centers');
|
$formCenters = $this->createCreateFormExport($alias, 'generate_centers');
|
||||||
@ -404,7 +405,12 @@ class ExportController extends Controller
|
|||||||
$formFormatter->handleRequest($request);
|
$formFormatter->handleRequest($request);
|
||||||
$dataFormatter = $formFormatter->getData();
|
$dataFormatter = $formFormatter->getData();
|
||||||
|
|
||||||
return $exportManager->generate($alias, $dataCenters['centers'],
|
// temporary hack due to bug with fputcsv and header_get
|
||||||
|
header('Content-Type: text/csv');
|
||||||
|
|
||||||
|
$r = $exportManager->generate($alias, $dataCenters['centers'],
|
||||||
$dataExport['export'], $dataFormatter['formatter']);
|
$dataExport['export'], $dataFormatter['formatter']);
|
||||||
|
|
||||||
|
return $r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user