0
Personal I am generating reports in pdf and I am with the following problem, I need to set the id of the volunteer to print the pdf with the data of the volunteer, I tried as follows by the link:
view
<?= $this->Html->link(__('Imprimir'), ['action' => 'pdf_view2', $voluntario->id], ['class'=>'btn btn-info btn-xs']) ?>
it turns out that even though pdf printing obeys only the id I pass in the controller, so if I pass null, it comes null, if I pass the normal id as 2... comes the volunteer number 2... as I can pass the volunteer id to pdf_view?
controller
public function pdf_view2($schedule_id = null, $id = 2){
$this->viewBuilder()->layout('ajax');
$this->set('title', 'My Great Title');
$this->set('file_name', '2016-06' . '_June_CLM.pdf');
$this->response->type('pdf');
/* $this->paginate = [
'contain' => ['Oficinas']
];
$voluntarios = $this->paginate($this->Voluntarios);
$this->set(compact('voluntarios'));*/
$voluntario = $this->Voluntarios->get($id, [
'contain' => ['Oficinas']
]);
$this->set('voluntario', $voluntario);
I need to take this id=2 and put so that it takes the volunteer id, how to do?
did not work... id goes in the right url ... but for some reason it does not return the volunteer in pdf... it only returns when I set it in the controller function
– André
I updated the answer! Check the value of $voluntario->id.
– Edrian Biagi
get buddy. thanks a lot for the help, the value of the voluntario id was ok... a facebook guy advised me and I just switched places the $schedule_id = null and the $id = null kkk anyway thanks so much for helping me
– André