1

I do understand how to config validation works in symfony2 (treeBuilder) but I cannot validate at least one array with two values

mike_test:
    param: 
        - [123, 20]
        - [234, 40]

So I start with this:

$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('mike_test');
$rootNode
    ->children()
        ->arrayNode('param')

        ->end()
    ->end();

And I get a message "Unrecognized options "0, 1" under "mike_test.param" Can someone help

1

1 Answer 1

3

If it is still possible, you must define the type or category of data in your array

->arrayNode('param')
     ->isRequired()
     ->prototype('scalar')->end()
->end()
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.