If you happen to run into the error ‘The “default” context does not exist’ when running a custom symfony task the chances are you’re using a method of an object which utilizes sfContext. It seems symfony does not create an instance of sfContext by default and thus the error is returned. The only solution to this issue that I have found so far is to create a new instance of sfContext with your tasks configuration as the set parameters. The following should be added to the top of the tasks execute method:
sfContext::createInstance($this->configuration);
Example:
protected function execute ($arguments = array(), $options = array()) { sfContext::createInstance($this->configuration); // ... Your code }
You should no longer run into the context error within tasks.


