Todd Valentine
Todd Valentine

Reputation: 185

Change property type in Silverstripe YAML

I am needing to change a private static property set on a class in Silverstripe. The initial value of the property is set to a boolean. I can change the value in my _config.php file with the following

Config::inst()->remove('class_name', 'property');
Config::inst()->update('class_name', 'property', []);

What is the proper syntax to achieve the above using my _conf.yml configuration? I would like to avoid spreading out my configuration amongst multiple files.

Upvotes: 0

Views: 363

Answers (1)

Cam
Cam

Reputation: 174

In the config.yml file you should do the following:

class_name:
  property: string-value

or if it is an array:

class_name:
  property:
    - one
    - two

I think what you are asking is how to replace the casting of the static, I think you might only be able to do that as you have in your example above as the yml config only sets existing config values rather than changes their structure.

Upvotes: 1

Related Questions