DependencyInjection/Configuration.php
author cavaliet
Mon, 28 Nov 2011 10:34:24 +0100
changeset 46 6f643fc1de26
parent 36 540607cf3447
child 63 774ba82dca59
permissions -rwxr-xr-x
commit changes before update.
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
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
namespace IRI\Bundle\WikiTagBundle\DependencyInjection;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
36
540607cf3447 Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
cavaliet
parents: 33
diff changeset
     5
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
     6
1
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
use Symfony\Component\Config\Definition\ConfigurationInterface;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
/**
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * 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
    12
 *
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 * 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
    14
 */
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
class Configuration implements 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
     * {@inheritDoc}
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
    public function getConfigTreeBuilder()
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
        $treeBuilder = new TreeBuilder();
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
        $rootNode = $treeBuilder->root('wiki_tag');
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    24
        
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    25
        $rootNode
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    26
            ->children()
21
780ef37e63b9 add route parameter
ymh <ymh.work@gmail.com>
parents: 17
diff changeset
    27
                ->scalarNode('route_for_documents_by_tag')->defaultNull()->end()
780ef37e63b9 add route parameter
ymh <ymh.work@gmail.com>
parents: 17
diff changeset
    28
                ->scalarNode('document_class')->isRequired()->end()
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    29
                ->scalarNode('document_id_column')->defaultValue('id')->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    30
            ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    31
            ->fixXmlConfig('field')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    32
            ->children()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    33
                ->arrayNode('fields')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    34
                    ->treatNullLike(array())
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    35
                    ->useAttributeAsKey('name')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    36
                    ->prototype('array')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    37
                        ->performNoDeepMerging()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    38
                        ->children()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    39
                            ->scalarNode('type')->defaultValue('text')->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    40
                            ->scalarNode('length')
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    41
                                ->beforeNormalization()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    42
                                    ->ifString()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    43
                                    ->then(function($v) { return intval($v); })
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    44
                                ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    45
                            ->end()
23
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    46
                            ->scalarNode('weight')->defaultValue(1.0)
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    47
                                ->beforeNormalization()
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    48
                                    ->ifString()
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    49
                                    ->then(function($v) { return floatval($v); })
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    50
                                ->end()
b435f8055cb4 improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents: 21
diff changeset
    51
                            ->end()
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    52
                            ->scalarNode('accessor')->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    53
                        ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    54
                    ->end()
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    55
                ->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
    56
                ->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
    57
                    ->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
    58
                    ->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
    59
                    ->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
    60
                    ->end()
46
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    61
                ->end()
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    62
                ->arrayNode('document_list_profile')
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    63
                    ->treatNullLike(array())
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    64
                    ->useAttributeAsKey('name')
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    65
                    ->prototype('variable')
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    66
                    ->end()
6f643fc1de26 commit changes before update.
cavaliet
parents: 36
diff changeset
    67
                ->end()
17
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    68
            ->end();
81962874e172 First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    69
        
1
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
        return $treeBuilder;
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
    }
06a22ff5d58d first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
}