I would like to import constant in the Symfony2 Service Container. There is a cookbook which explains how to do it: link to cookbook
According to this cookbook, you can't import constant in a yml file. However, it has not been modified for 3 month, and not updated when Symfony2 went live.
Does anybody kno开发者_如何学运维w if it's possible to import constant with a yml file now ?
Thanks in advance
if you use the symfony standard edition, you can add parameters into the app/config/parameters.ini
file.
If you really want to use a yaml file, you can do that:
parameters:
my.parameter: foobar
and then, you will be able to access in a controller like this:
$this->container->getParameter('my.parameter');
精彩评论