variablePrototype example

->children()
                        ->integerNode('max_host_connections')
                            ->info('The maximum number of connections to a single host.')
                        ->end()
                        ->arrayNode('default_options')
                            ->fixXmlConfig('header')
                            ->children()
                                ->arrayNode('headers')
                                    ->info('Associative array: header => value(s).')
                                    ->useAttributeAsKey('name')
                                    ->normalizeKeys(false)
                                    ->variablePrototype()->end()
                                ->end()
                                ->arrayNode('vars')
                                    ->info('Associative array: the default vars used to expand the templated URI.')
                                    ->normalizeKeys(false)
                                    ->variablePrototype()->end()
                                ->end()
                                ->integerNode('max_redirects')
                                    ->info('The maximum number of redirects to follow.')
                                ->end()
                                ->scalarNode('http_version')
                                    ->info('The default HTTP version, typically 1.1 or 2.0, leave to null for the best version.')
                                
->scalarNode('throw_exception')->end()
                ->scalarNode('logger_level')->defaultValue($debug ? Level::Debug : Level::Error)->end()
                ->arrayNode('ssl')
                    ->children()
                        ->scalarNode('cert_path')->end()
                        ->scalarNode('cert_password')->end()
                        ->scalarNode('cert_key_path')->end()
                        ->scalarNode('cert_key_password')->end()
                        ->booleanNode('verify_server_cert')->defaultValue(true)->end()
                    ->end()
                ->end()
                ->arrayNode('index_settings')->variablePrototype()->end()->end()
                ->arrayNode('analysis')->performNoDeepMerging()->variablePrototype()->end()->end()
                ->arrayNode('language_analyzer_mapping')->defaultValue([])->scalarPrototype()->end()->end()
                ->arrayNode('dynamic_templates')->performNoDeepMerging()->variablePrototype()->end()->end()
                ->arrayNode('product')
                    ->children()
                        ->arrayNode('custom_fields_mapping')
                            ->variablePrototype()->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('search')
                    
->end()
                ->end()
            ->end()
        ;

        $this->assertSame([]$node->getNode()->normalize(['value' => null]));
    }

    public function testPrototypeVariable()
    {
        $node = new ArrayNodeDefinition('root');
        $this->assertEquals($node->prototype('variable')$node->variablePrototype());
    }

    public function testPrototypeScalar()
    {
        $node = new ArrayNodeDefinition('root');
        $this->assertEquals($node->prototype('scalar')$node->scalarPrototype());
    }

    public function testPrototypeBoolean()
    {
        $node = new ArrayNodeDefinition('root');
        
Home | Imprint | This part of the site doesn't use cookies.