0
votes

Obviously it is not that simple. Let's start from the beginning: I'm working on a shared project and yesterday I've been asked to add the plugin mgI18n. I followed the readme file step by step, but when it came down to run the command line to create the table used by the plugin, I got this:

database "" does not exists

I searched it, and I found out that sfConfig::get('app_mgI18nPlugin_connection'); returned an empty value. It was weird, because I've done every step right, setting the value in my app.yml and clearing symfony cache, so I logged sfConfig::getAll(); and found out that the only values for 'app_' stored here were the ones from the file app.yml in the plugin folder of kdDoctrineGuardFacebookConnectPlugin. I've already tried removing that file and clearing the cache, obtaining only to lose these values.

Here is the file contents:

project/apps/frontend/config/app.yml

all:   
  #other values  
  facebook:
    appId:                  yyy
    secret:                 yyy
    cookie:                 true
    script_lang:            fr_FR
    perms:                  email  
  mgI18nPlugin:
    connection: doctrine
    cultures_available: 
      fr: Français
      en: English
      it: Italiano
      de: Deutsch

project/plugins/kdDoctrineGuardFacebookConnectPlugin/config/app.yml

all:
  facebook:
    appId:                  xxx
    secret:                 xxx
    cookie:                 true
    script_lang:            fr_FR
    perms:                  email

and this is what I get when I log sfConfig::getAll(); :

array('app_facebook_appId' => 'xxx', 
'app_facebook_secret' => 'xxx',
'app_facebook_cookie' => true,
'app_facebook_script_lang' => 'fr_FR',
'app_facebook_perms' => 'email',
)

Why the values for the main app.yml are not loaded? How do I correct this behaviour?

Thank you all in advance for your help, if you need more specifics I'll glady add them

1
I tried to log sfConfig::getAll(); in an action and I get the same resultJericho Pumpkin
also tried to install the plugin from scratch after reverting the project, this time using pear, but it helds the same result. I've also validated the yaml files with this yaml parser and found out nothing...Jericho Pumpkin

1 Answers

1
votes

If I understood you well you are in a command line task context (some sfTask). Symfony tasks by default do not run in application context. In most cases just call your task as

./symfony namespace:name --application=frontend

and you will have your configs. If it is your own task just add it an option with default value in your configure method:

$this->addOptions(array(
  new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'),
  ...
)

Plugin settings are loaded correctly, because plugins are configured per project not application (you enable them in ProjectConfiguration, not generated frontendConfiguration class)