public function exportAction(Request $request, $name) {

        $windows = DataTablesExportHelper::isWindows($request);

        $dtProvider = $this->getDataTablesProvider($name);

        $dtExporter = $this->getDataTablesCSVExporter($dtProvider);

        $repository = $this->getDataTablesRepository($dtProvider);

        $filename = (new DateTime())->format("Y.m.d-H.i.s") . "-" . $dtProvider->getName() . ".csv";

        $charset = true === $windows ? "iso-8859-1" : "utf-8";

        $response = new StreamedResponse();
        $response->headers->set("Content-Disposition", "attachment; filename=\"" . $filename . "\"");
        $response->headers->set("Content-Type", "text/csv; charset=" . $charset);
        $response->setCallback(function() use ($dtProvider, $repository, $dtExporter, $windows) {
            $this->exportDataTablesCallback($dtProvider, $repository, $dtExporter, $windows);
        });
        $response->setStatusCode(200);

        return $response;
    }
public function exportAction(Request $request, $name) {

        $windows = DataTablesExportHelper::isWindows($request);

        $dtProvider = $this->getDataTablesProvider($name);

        $dtExporter = $this->getDataTablesCSVExporter($dtProvider);

        $repository = $this->getDataTablesRepository($dtProvider);

        $filename = (new DateTime())->format("Y.m.d-H.i.s") . "-" . $dtProvider->getName() . ".csv";

        $charset = true === $windows ? "iso-8859-1" : "utf-8";

        $response = new StreamedResponse();
        $response->headers->set("Content-Disposition", "attachment; filename=\"" . $filename . "\"");
        $response->headers->set("Content-Type", "text/csv; charset=" . $charset);
        $response->setCallback(function() use ($dtProvider, $repository, $dtExporter, $windows) {
            $this->exportDataTablesCallback($dtProvider, $repository, $dtExporter, $windows);
        });
        $response->setStatusCode(200);

        return $response;
    }
public function exportAction ( Request $ request , $ name ) { $ windows = DataTablesExportHelper :: isWindows ( $ request ) ; $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; $ dtExporter = $ this -> getDataTablesCSVExporter ( $ dtProvider ) ; $ repository = $ this -> getDataTablesRepository ( $ dtProvider ) ; $ filename = ( new DateTime ( ) ) -> format ( "Y.m.d-H.i.s" ) . "-" . $ dtProvider -> getName ( ) . ".csv" ; $ charset = true === $ windows ? "iso-8859-1" : "utf-8" ; $ response = new StreamedResponse ( ) ; $ response -> headers -> set ( "Content-Disposition" , "attachment; filename=\"" . $ filename . "\"" ) ; $ response -> headers -> set ( "Content-Type" , "text/csv; charset=" . $ charset ) ; $ response -> setCallback ( function ( ) use ( $ dtProvider , $ repository , $ dtExporter , $ windows ) { $ this -> exportDataTablesCallback ( $ dtProvider , $ repository , $ dtExporter , $ windows ) ; } ) ; $ response -> setStatusCode ( 200 ) ; return $ response ; }
Export all entities.

@param string $name The provider name.
@return Response Returns the response.
@throws UnregisteredDataTablesProviderException Throws an unregistered provider exception.
@throws BadDataTablesCSVExporterException Throws a bad CSV exporter exception.
@throws BadDataTablesRepositoryException Throws a bad repository exception.
Export all entities .