Reputation: 43
I want to check if available a some attribute in config object and if not, add new attribute to config object in bootstrap. How ever is it possible ?
example :-
$options['allowModifications'] = true;
$config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/clientsettings.ini', null, $options);
if (!isset($config->offers->default)) {
$config->offers->default = "Best Available Rate";
}
Zend_Registry::set('clientSettings', $config);
Upvotes: 1
Views: 116
Reputation: 43
I realized a solution,
$options['allowModifications'] = true;
$config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/clientsettings.ini', null, $options);
if (!isset($config->offers->default)) {
$offers = ['default' => "Best Available Rate"];
$config->offers = $offers;
}
Zend_Registry::set('clientSettings', $config);
but finally i thought this is not a good idea, allowing config object to modification.
Upvotes: 1