1

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);

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.