Symfony 2 - Getting values from config.yml to SomeController.php (not defined issue) -
here case. config.yml contains fallowing set:
... framework: #esi: ~ translator: { fallbacks: ["%locale%"] } secret: "%secret%" router: resource: "%kernel.root_dir%/config/routing.yml" strict_requirements: ~ form: ~ csrf_protection: ~ validation: { enable_annotations: true } templating: engines: ['twig'] #assets_version: someversionscheme default_locale: "%locale%" ...
i trying access value of default_locale in controller with:
... $this->container->getparameter('framework.default_locale'); ...
but wont work... idea why prompts me value not defined?
regards
try $this->container->getparameter('locale');
locale must defined in parameters.yml
Comments
Post a Comment