Hi,
I use a service that returns a default value defined in config file, but I need on runtime to update this value in order to use it later. Unfurtunately, it's always the default value that is returned.. my code:
-config.ini
[helpers]
stHelper = defaultValue
- services.php
$di->setShared('helperBag', function() use ($config) {
return $config->helpers;
});
- controller.php
public function modifyDefaultValueAction() {
$this->getDi()->getHelperBag()->remove('stHelper');
$this->getDi()->getHelperBag()->set('stHelper', 'newValue');
}
//later
public function getModifiedValueAction() {
$this->view->modifiedValue = $this->getDi()->getHelperBag()->stHelper;
}
});
what's wrong?