Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 420
JERC Avatar asked Mar 08 '12 23:03

JERC


1 Answers

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")
    ));
    
like image 82
Maerlyn Avatar answered Oct 18 '22 01:10

Maerlyn