This is how I have done it as well. The difference between the Shell and the cake website is the Shell loads pretty much nothing for you. The Cake Magic is fairly week at the shell level. I don't think that is a bad thing, but you do have to load up and build bind your objects using standard php techniques.
You might also want to look at http://github.com/MSeven/cakephp_queue which could help with your overall goal of offloading process intense events or background processing which has nothing to do with the UI that needs to be returned to the user. On Mar 18, 12:42 pm, amiable_indian <[email protected]> wrote: > I am learning Cake Shells and thinking of using them where I want to > offload the work asynchronously by calling multiple shell commands > ( housekeeping ) from a controller and run them parallel in > background, without making user to wait. > > From Shell I wanted to use existing Components which were doing part > of the work that Shell needs to perform. These Components were coded > earlier and have interdependencies with other Components defined using > the way suggested in book : > > var $components = array('Dependency1',...); > > [ Based on > ::http://book.cakephp.org/view/787/Using-other-Components-in-your-Compo... > ] > > This worked when I was calling component from other controllers, > however now when I am calling the same component from Shell, it > started giving me errors related to dependencies. > > To remove these errors, I had to import dependencies and create their > objects before using them > > App::Import('Component','Dependency1'); > .. > class MyComponent ......... { > ..function initialize (....) { > .. > .. $this->Dependency1 = & new Dependency1Component(); > .. > ..} > .. > > } > > Now the code is working, but I just wanted to confirm with the > community that what is the recommended practice. > > TIA, > > _amiable_indian_ Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
