In my Configuration.php I have a structure as following:
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('my_bundle');
$rootNode
->children()
->scalarNode('class')->cannotBeEmpty()->end()
->arrayNode('social_network')
->children()
->arrayNode('facebook')
->validate()
->ifTrue(function($node) {
// my logic to validate if the 'class' specified implements my trait
})
->thenInvalid('You must use XXXXXX trait in your class.')
->end()
->children()
->scalarNode('app_id')->isRequired()->cannotBeEmpty()->end()
->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()
->end()
->end()
->end()
->end()
->end();
return $treeBuilder;
}
I need to check if the specified class implement a specific trait part of my bundle.
How can I read the value of the class within the function($node) ?