Using CakePHP 1.3 I have an existing InvoicesController with a method single_invoice($customer_id), and all works great through normal use. However, I want to do the same thing through the cake shell and build it as a cronjob.
I have the shell created, and it does run as a cronjob, so that is not the problem. The problem is that I cannot get view rendered from the cronjob. Basically, here is what I have so far:
class InvoiceCreationShell extends Shell {
var $uses = array('Institution');
function main()
{
$institutions = $this->Institution->find('all');
foreach ($institutions as $institution)
{
App::import('Core', 'Controller');
App::import('Controller', 'Invoices');
$Invoices = new InvoicesController;
$Invoices->constructClasses();
$invoice = $Invoices->single_invoice();
$pdf = create_pdf($invoice);
file_put_contents($pdf);
}
}
}
What I would like is for the rendered view content to be returned via the $invoice parameter.