How pass the variable form config file form one plugin to another in Symfony?
I am new to Symfony 1.4
And I have a project in which I have 2 plugins. In first plugin named myPlugin1
I have the config
folder and in him the app.yml
file, in which I have set a predefined "variable" like that:
all:
carriage:
cost:
prepaid: 10
What I need is to pass this "variable" in a class from my other plugin, myPlugin2
, which actually handle the payments costs.
How can I pass this "variable" to my class?
UPDATE: Ca开发者_开发百科n I do this like that? Or this can be used only in current plugin?
sfConfig::get('all_carriage_cost_prepaid')
the actual call must be:
sfConfig::get('app_carriage_cost_prepaid')
The starting prefix is related to the configuration file name. Source here.
Regards.
I have found finally how to do it. Is like that:
$myarray = sfConfig::get('all_carriage_cost');
$thevalue = $myarray['cost'];
Here is the source.
精彩评论