Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV file is empty when using get method, though Arrray has values #84

Closed
Jahed1 opened this issue Sep 12, 2017 · 1 comment
Closed

CSV file is empty when using get method, though Arrray has values #84

Jahed1 opened this issue Sep 12, 2017 · 1 comment

Comments

@Jahed1
Copy link

Jahed1 commented Sep 12, 2017

when i use find method it works fine.

public function exportdependants($id){

  $dependants = $this->Dependants->get($id);
  	
	$_header = ['Full Name','Relationship','Date Of Birth','Dependant Until','Gender'];
$_extract = array('full_name','relationship','date_of_birth','dependant_until','gender');
	
	$this->response->download('Dependants.csv');
	$_serialize = ['dependants'];
	
$this->set(compact('dependants','_serialize','_header','_extract'));

  		$this->viewBuilder()->className('CsvView.Csv');
	
	return;

}

@Jahed1 Jahed1 changed the title Downloading empty csv file when using get method to get data Downloading empty csv file when using get method to get Sep 12, 2017
@Jahed1 Jahed1 changed the title Downloading empty csv file when using get method to get CSV file is empty when using get method, though Arrray has values Sep 12, 2017
@Jahed1 Jahed1 closed this as completed Sep 13, 2017
@josegonzalez
Copy link
Member

I believe $dependants needs to be set in an array. Since its a single object, we can't extract the data for the row.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants