I have some functionality that I'm currently migrating from CodeIgniter 
1.7.3 to CakePHP 2.2.3, and I'm wondering how best to tackle a particular 
scenario.

The currently functionality that I'm migrating reads data from the 
database, and will generate a PDF file via FPDF.  

Currently, I have a controller that will give an option to print to screen, 
or print to file. In both cases, the controller action will access the 
model to get the information it needs for printing, and then will call 
render('print') to generate the PDF.  The printToFile action will pass a 
file name which will indicate to FPDF to output to a file, rather than 
stream to the browser.

The print view calls an element, passing the data and filename, to actually 
generate the PDF.

Now, I have a different controller, that will probably be migrated to a 
shell or task (since it is run from the command line), that wants to call 
the print to file functionality, but I'm not sure how to arrange it.  I've 
generally felt that one controller calling the functionality of another 
controller is bad form, so I'm looking for ideas.  One possibility is to 
call the element functionality directly, from the controller(/shell/task), 
but that may not be such a good idea, either.

In CodeIgniter, I had a library function that I would call from the 
controller that would use FPDF directly.

Can any give me some pointers on calling View functionality repeated from a 
batch (whether it be from a Controller, as it is at the moment, or a 
Shell/Task, as it may end up getting migrated to)?  Keeping in mind that 
PDF generation is not the only thing that the batch files does, so control 
needs to be passed back to the batch file at some point, to keep processing.

Regards
Reuben Helms

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to