DependencyInjection/Configuration.php
author ymh <ymh.work@gmail.com>
Fri, 26 Sep 2014 10:04:40 +0200
changeset 136 f209fcb0df6c
parent 112 14653baf4f6b
permissions -rwxr-xr-x
Added tag V00.18 for changeset ab728cb3632c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
74
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     2
/*
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     3
 * This file is part of the WikiTagBundle package.
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     4
 *
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     5
 * (c) IRI <http://www.iri.centrepompidou.fr/>
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     6
 *
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     7
 * For the full copyright and license information, please view the LICENSE
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     8
 * file that was distributed with this source code.
901463f9b11c add headers for public repository release
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
     9
 */
1
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
namespace IRI\Bundle\WikiTagBundle\DependencyInjection;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
36
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
    12
use Symfony\Component\Config\Definition\ScalarNode;
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
    13
1
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
use Symfony\Component\Config\Definition\ConfigurationInterface;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
/**
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 * This is the class that validates and merges configuration from your app/config files
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 *
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 */
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
class Configuration implements ConfigurationInterface
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
{
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
    /**
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
     * {@inheritDoc}
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
     */
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
    public function getConfigTreeBuilder()
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
    {
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
        $treeBuilder = new TreeBuilder();
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
        $rootNode = $treeBuilder->root('wiki_tag');
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    31
        
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    32
        $rootNode
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    33
            ->children()
21
780ef37e63b9 add route parameter
ymh <ymh.work@gmail.com>
parents: 17
diff changeset
    34
                ->scalarNode('route_for_documents_by_tag')->defaultNull()->end()
63
774ba82dca59 add tests and fixtures
ymh <ymh.work@gmail.com>
parents: 46
diff changeset
    35
                ->booleanNode('ignore_wikipedia_error')->defaultFalse()->end()
21
780ef37e63b9 add route parameter
ymh <ymh.work@gmail.com>
parents: 17
diff changeset
    36
                ->scalarNode('document_class')->isRequired()->end()
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    37
                ->scalarNode('document_id_column')->defaultValue('id')->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    38
            ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    39
            ->fixXmlConfig('field')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    40
            ->children()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    41
                ->arrayNode('fields')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    42
                    ->treatNullLike(array())
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    43
                    ->useAttributeAsKey('name')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    44
                    ->prototype('array')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    45
                        ->performNoDeepMerging()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    46
                        ->children()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    47
                            ->scalarNode('type')->defaultValue('text')->end()
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 63
diff changeset
    48
                            ->scalarNode('length')->defaultValue(1024)
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    49
                                ->beforeNormalization()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    50
                                    ->ifString()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    51
                                    ->then(function($v) { return intval($v); })
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    52
                                ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    53
                            ->end()
23
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    54
                            ->scalarNode('weight')->defaultValue(1.0)
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    55
                                ->beforeNormalization()
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    56
                                    ->ifString()
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    57
                                    ->then(function($v) { return floatval($v); })
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    58
                                ->end()
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    59
                            ->end()
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    60
                            ->scalarNode('accessor')->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    61
                        ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    62
                    ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    63
                ->end()
112
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 77
diff changeset
    64
                ->arrayNode('url_templates')
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 77
diff changeset
    65
                    ->treatNullLike(array())
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 77
diff changeset
    66
                    ->useAttributeAsKey('name')
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 77
diff changeset
    67
                    ->prototype('variable')
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 77
diff changeset
    68
                    ->end()
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 77
diff changeset
    69
                ->end()
36
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
    70
                ->arrayNode('reactive_selectors')
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
    71
                    ->treatNullLike(array())
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
    72
                    ->useAttributeAsKey('name')
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
    73
                    ->prototype('variable')
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
    74
                    ->end()
46
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    75
                ->end()
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    76
                ->arrayNode('document_list_profile')
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    77
                    ->treatNullLike(array())
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    78
                    ->useAttributeAsKey('name')
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    79
                    ->prototype('variable')
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    80
                    ->end()
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    81
                ->end()
76
bb7808e180c3 Add configuration to enable curl request with proxy or any other CURLOPT
cavaliet
parents: 68
diff changeset
    82
                ->arrayNode('curl_options')
bb7808e180c3 Add configuration to enable curl request with proxy or any other CURLOPT
cavaliet
parents: 68
diff changeset
    83
                    ->treatNullLike(array())
bb7808e180c3 Add configuration to enable curl request with proxy or any other CURLOPT
cavaliet
parents: 68
diff changeset
    84
                    ->useAttributeAsKey('name')
bb7808e180c3 Add configuration to enable curl request with proxy or any other CURLOPT
cavaliet
parents: 68
diff changeset
    85
                    ->prototype('variable')
bb7808e180c3 Add configuration to enable curl request with proxy or any other CURLOPT
cavaliet
parents: 68
diff changeset
    86
                    ->end()
bb7808e180c3 Add configuration to enable curl request with proxy or any other CURLOPT
cavaliet
parents: 68
diff changeset
    87
                ->end()
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    88
            ->end();
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    89
        
1
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
        return $treeBuilder;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
    }
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
}