Symfony task “default” context

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:

The application name and the environment can come from CLI options. More on Doctrine tasks (I could only find 1.2 equivalent): http://www.symfony-project.org/cookbook/1_2/en/tasks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">