0

I'd like to retrieve the Global Parameters from config.yml to entity

    twig:
    ..
        globals:
            image404: image-missing.png

and i want use this param from my static var like:

class Foo extends Bar {

    private static $image404 = "HERE GLOBAL PARAM";
Barno
  • 3,271
  • 5
  • 28
  • 58
Twinsen
  • 863
  • 1
  • 12
  • 23

1 Answers1

0

Do

 var_dump($this->container->parameters);

and have a look at the parameter names. There are not always equal to the names in your config.yml. E.g.

$this->container->parameters['twig.globals']['image404'];

may return null. This question was already asked: How do I read configuration settings from Symfony2 config.yml?

Community
  • 1
  • 1
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
  • if i use xdebug inside Foo,I haven't `$this->container` but `$this` is my object bundle `{Acme\FooBundle\Entity\Foo}` ... Thanks – Twinsen Dec 16 '13 at 15:10