symfony - symfony2 semantic bundle configuration - conditional required parameter -
i working on bundle have couple of required parameters. want able disable bundle setting enabled: false
in parameters.yml. if bundle disabled configuration parameters cant required more.
is there anyway can in bundle configuration class required parameters required if enabled parameter true?
thank you.
edit:
my configuration.php
$rootnode ->children() ->arraynode('settings') ->canbeenabled() ->children() ->scalarnode('api_key') ->isrequired() ->cannotbeempty() ->end() ->scalarnode('api_secret') ->isrequired() ->cannotbeempty() ->end() ->booleannode('debug') ->defaultfalse() ->cannotbeempty() ->end() ->booleannode('ssl') ->defaultfalse() ->end() ->end() ->end();
if set in parameters.yml,
my_bundle: settings: enabled: false
it shouldnt complain "the child node "api_key" @ path "my_bundle.settings" must configured."
Comments
Post a Comment