[转]using components in Cakephp 2+ Shell
1 <?php 2 App::uses('AppShell', 'Console/Command'); 3 App::uses('ComponentCollection', 'Controller'); 4 App::uses('Controller', 'Controller'); 5 App::uses('MTurkComponent', 'Controller/Component'); 6 7 class ProcessCompletedTask extends Shell { 8 public function execute() { 9 $this->out("Processing...\n"); 10 $collection = new ComponentCollection(); 11 $this->MTurk = new MTurkComponent($collection); 12 $controller = new Controller(); 13 $this->MTurk->initialize($controller); 14 15 $this->MTurk->processHITs(); 16 $this->out("Complete\n"); 17 } 18 }
原文出处:
using components in Cakephp 2+ Shell