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-Component
]

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

Reply via email to