Sorry if this is a likely stupid question, but I can't seem to find the answer anywhere. Searching for CakePHP console examples outside of using it for ACL and baking seems mighty thin on google. Maybe I'm overlooking something that should be obvious?
The Backstory: I have cakephp doing some intensive data processing using many different actions in a specified sequence and even with pagination to avoid timeouts. I decided to try to automate this by setting up a cake shell function to go through all of the steps and then I can just invoke the magic from the command line and output report results into a file. I followed the example from this page: http://twit88.com/blog/2008/02/14/php-writing-a-console-program-in-cakephp/ The Issue: What is happening when I try to invoke a controller action from within a shell function is that I get the following error (this only happens when the controller action I invoke has within a call to a model method --as most controller actions are wont to do): Fatal error: Call to a member function on a non-object in /var/www/.../ httpdocs/app/controllers/cities_controller.php on line 34 Observations: 1) The action I'm invoking works fine when called from a browser 2) The 'member function' in question is none other than the standard built-in findAll(), which I would hope would be supported 'out of the box' when trying to invoke controller actions from the console. My Question: Am I approaching this the wrong way? Is there a shortcut to invoking controller actions from the console that I've overlooked? App:import sure seems hacky. Reference: class ReportShell extends Shell { var $uses = array('City'); var $tasks = array ('Project','DbConfig','Model','Controller','View','Plugin'); var $CitiesController = null; function initialize() { $this->_loadModels(); } function main() { App::import('Controller', 'Cities'); $this->CitiesController = new CitiesController(); $this->out($this->CitiesController->export_overall('Massachusetts')); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---