If you want to export the data in the database as a CSV file in symfony, try the following:
The code is as follows:
Public function executeRegistrantsToCsv (){
$ Id = $ this-> getRequestParameter ('id ');
$ C = new Criteria ();
$ C-> add (RegistrantPeer: EVENT_ID, $ id );
$ C-> add (RegistrantPeer: STATUS, 1 );
$ This-> aObjReg = RegistrantPeer: doSelect ($ c );
$ This-> forward404Unless ($ this-> aObjReg );
$ This-> setlayout ('csv ');
$ This-> getResponse ()-> clearHttpHeaders ();
$ This-> getResponse ()-> setHttpHeader ('content-type', 'application/vnd. ms-excel ');
$ This-> getResponse ()-> setHttpHeader ('content-disposition', 'attachment; filename = registrants_report_event _ '. $ id. '.csv ');
}
In the template registrantsToCsvSuccess. php:
The code is as follows:
Title, Name, Email, Phone, Organisation, State, City, Country, Login Date, IpAddress
GetTitle ()?>, GetName ()?>, GetEmail ()?>, GetPhone ()?>, GetOrganisation ()?>, GetState ()?>, GetCity ()?>, GetCountry ()?>, GetLoginDate ()?>, GetIpAddress ()?>,
In the templates/csv. php:
GetRaw ('SF _ content')?>
From: http://blog.baddog.net.au/sonius/steve-sonius/how-to-export-data-as-a-csv-file-in-symfony/
If it doesn't work, try this: http://blog.baddog.net.au/sonius/steve-sonius/how-to-export-data-as-an-xls-or-csv-file-from-the-admin-generator-in-symfony-1-4/