7

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?

j0k
  • 22,600
  • 28
  • 79
  • 90
JERC
  • 1,584
  • 3
  • 17
  • 38

1 Answers1

15

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")
    ));
    
Maerlyn
  • 33,687
  • 18
  • 94
  • 85
  • The signature of the sfCommandOption constructor is `($name, $shortcut = null, $mode = null, $help = '', $default = null)` - You put "frontend" as the shortcut name of the command option, where it should've gone at the end as the 5th param to be the default value. – VanTanev May 16 '13 at 20:38