JERC
JERC

Reputation: 1624

sfConfig::get in a task in symfony

I have tried to use a parameter in my app.yml file inside a task in symfony 1.4, but it doesnt get the value.

sfConfig::get()

Do you have any advice?

Upvotes: 7

Views: 4780

Answers (1)

Maerlyn
Maerlyn

Reputation: 34107

By default tasks are ran only with a project - meaning they don't have access to your settings in app.yml. You either need to:

  • explicitly pass an app parameter every time you call the task, this is done like:

    php symfony ns:task --application=frontend
    
  • add it as a default parameter in your configure():

    $this->addOptions(array(
      new sfCommandOption('application', "app", sfCommandOption::PARAMETER_REQUIRED, 'The application name', "frontend")
    ));
    

Upvotes: 15

Related Questions