In app/config/config.yml I’ve added some custom settings for my bundle
acme:
acme_services:
service_a:
options: { name: I, id: X, type: F, error: E }
service_b:
options: { name: J, id: Z, type: F, error: E }
Now in src/ACME/Bundle/ACMEBundle/DependencyInjection/Configuration.php how do I set the default and / or check for service_a/service_b?
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('acme');
$rootNode
->children()
// also removed the ->end() for each arrayNode but then I get a Fatal Error
->arrayNode('acme_services')->end()
->arrayNode('another')->end()
->arrayNode('more')->end()
->arrayNode('blah')->end()
->end();
return $treeBuilder;
}
So I need pull the service_a and service_b arrays but I’m getting Unrecognized options error for service_a and service_b.
The desired result is I would like to have both service_a and service_b in the acme_services array, this why I can validate against the acme_services array for whatever service is used, either service_a or service_b.
Note: In PHP I would write it like this: (not sure if this is correct but it’s an example)
$acme_services = array(
'acme_services' =>
'service_a' => array(
'options' => array(
'name' => 'I',
'id' => 'X',
'type' => 'F',
'error'=> 'E',
)
),
'service_b' => array(
'options' => array(
'name' => 'J',
'id' => 'Z',
'type' => 'F',
'error'=> 'E',
)
)
);
You can try :