CakePHP 2.3.8: Calling Another Controller function in CronController.php

Aditya P Bhatt picture Aditya P Bhatt · Oct 13, 2013 · Viewed 35.9k times · Source

For CakePHP 2.3.8 How can I call Another Controller function in CronController.php

Any ideas?

Answer

Aditya P Bhatt picture Aditya P Bhatt · Oct 13, 2013

Below is the code:

App::import('Controller', 'Products'); // mention at top

// Instantiation // mention within cron function
$Products = new ProductsController;
// Call a method from
$Products->ControllerFunction();

Hope it helps some one !