Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function export()
- {
- $headings = [['Id', 'Prosjektnr', 'Navn', 'Kunde', 'Status']];
- $projects = $this->Projects
- ->find()
- ->select(['id', 'number', 'name', 'customer', 'status'])
- ->toArray();
- // debug($projects); $this->render(false);
- $_serialize = ['headings', 'projects'];
- $_delimiter = ';';
- $_enclosure = '';
- $_newline = '\r\n';
- // $_extension = 'utf8_decode';
- // $_bom = true;
- $this->response->download('projects.csv'); // <= setting the file name
- $this->viewBuilder()->className('CsvView.Csv');
- $this->set(compact('headings', 'projects', '_serialize', '_delimiter', '_enclosure', '_newline'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement