1. Create a Shell File in in /src/Shell folder and use suffix Shell in its name.
eg. AutoProgramShell.php <?php
namespace App\Shell; use Cake\Console\Shell;
\\Load your Controller Here
use App\Controller\AutoProgram\AutoManageRatesController;
class InsuranceAutoProgramShell extends Shell{
public function autoUpdateVendorRate(){
\\Create Object
$obj = new AutoManageRatesController();
$obj->autoUpdateVendorRate();\\call method
}
}
?>
From this file you will call your main Controller in which your program's logic is.
2. Create another Controller in the Controller Folder in which you will place you code logic.
3. To run the file from terminal go the directory....
* cd /var/www/html/projectname/bin
* To run it first run
./cake from terminal
* Your program name will be listed in[app]
* To run your Program./cake program_name method_name
NOTE : IN CASE OF CAKEPHP 2 IN THE FIRST STEP CREATE FILE IN /app/Console/Command/TestShell.php AND TO RUN IT LOCATE TO /app/Console ALL OTHER THINGS REMAINS THE SAME.
Comments :
Post a Comment