Output a CSV-file as a download
/** * Execute the action. */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendFormBuilderModel::exists($this->id)) { parent::execute(); $this->setFilter(); $this->setItems(); BackendCSV::outputCSV(date('Ymd_His') . '.csv', $this->rows, $this->columnHeaders); } else { // no item found, redirect to index, because somebody is f*****g with our url $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } }