Not sure if cake has a prettier, more efficient way of grabbing components inside of Shells and Tasks with cakephp’s cli, but here is a way which worked for me. Inside your Task (or Shell) just use the following in a similar manner for your component:


class FooTask extends Shell {
	App::import('Component', 'Bar');

	$this->Bar =& new BarComponent();

	$resp = $this->Bar->crazy_things();
	$this->out($resp);
}

Of course Foo and Bar are just for example. This works for me. Anyone know of another way?

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter

No related posts.