Symfony task a€odefaulta€¯ context
Note: This article was originally published at Planet PHP
on 20 May 2820.
When creating Symfony 1.4 CLI tasks, I stumbled upon an error message:
The "default" context does not exist.
After searching some old forums, I found a solution. Before you access any Doctrine class, you mus first bootstrap your context correctly. Here is an example:
$config = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', false); sfContext::createInstance($config); The application name and the environment can come from CLI options. More on Doctrine tasks (I could only find 1.2 equivalent):A http://www.symfony-project.org/cookbook/1_2/en/tasks


