Reputation: 310
How to define global variables, global functions for controller page?
For example I need to use a variable "$idleTime" in almost all the functions of controller class. So where to define that global variable "$idleTime" in Symfony2 Framework?
Upvotes: 0
Views: 1792
Reputation: 2342
Its not a global variable but, You can define in paramters.yml a parameter
idle_time: xxx
And the in the controller:
$this->container->getParameter('idle_time');
Upvotes: 4