Commit Graph

43 Commits

Author SHA1 Message Date
Martin Hasoň
8bb3208ab8 [Config] Loader::import must return imported data 2012-12-07 14:24:02 +01:00
Martin Hasoň
500cc3c4d7 [Config] Fixed tests on Windows 2012-12-05 13:56:40 +01:00
Fabien Potencier
03d22b74ec fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
Fabien Potencier
bdf9b7eb3e fixed CS 2012-05-21 16:05:09 +02:00
Fabien Potencier
26b489f499 fixed CS 2012-05-20 18:15:10 +02:00
Fabien Potencier
5878490b16 removed unused use statements 2011-11-24 07:16:14 +01:00
Fabien Potencier
851eb73778 removed unused use statements 2011-10-29 11:56:30 +02:00
Fabien Potencier
4259530856 [Config] fixed a unit test 2011-07-01 10:15:26 +02:00
Fabien Potencier
01ecaa4503 [Config] renamed FileLoaderImportException to FileLoaderLoadException and replaced some \InvalidArgumentException with this new exception class 2011-06-20 10:16:05 +02:00
Fabien Potencier
17cd08dc6c fixed CS 2011-06-08 19:56:59 +02:00
Fabien Potencier
65200aa86a added missing license headers 2011-05-31 10:57:06 +02:00
Brikou CARRE
e898445b94 removed empty lines/trailing spaces 2011-04-15 21:12:02 +02:00
Kris Wallsmith
c51b716180 [Config] simplified DirectoryResource to only allow one regex 2011-04-01 04:56:50 -07:00
Jeremy Mikola
e295bfc7a5 [Config] Alias used classes in NodeBuilderTest to avoid conflicts with fixture classes required in TreeBuilderTest
Depending on the order of execution of Config\Definition\Builder tests (due to filesystem ordering), namespace conflicts can occur between real classes and fixtures loaded by the TreeBuilderTest.
2011-03-30 19:52:00 -04:00
Fabien Potencier
03282f8d4e [Config] fixed a test 2011-03-22 19:55:16 +01:00
Sven Paulus
f93e4b2d73 Eleminate the need to manually clear the cache if a new controller file containing routing annotations is added - part II
* add unit tests
* introduce filename filter to DirectoryResource (to restrict change monitoring to a subset of files)
* modify AnnotationDirectoryLoader.php to use filename filter set on Controller\.php$
2011-03-22 09:03:45 +01:00
Victor Berchet
9fd7d05ecf [Config] Ability to add and override node types without having to subclass NodeBuilder 2011-03-18 00:32:35 +01:00
Victor Berchet
1e0ed22c55 [Config] Component refactoring
The Config component API have changed and the extension configuration files must be updated accordingly:

1. Array nodes must enclosed their children definition in ->children() ... ->end() calls:

Before:

    $treeBuilder->root('zend', 'array')
        ->arrayNode('logger')
            ->scalarNode('priority')->defaultValue('INFO')->end()
            ->booleanNode('log_errors')->defaultFalse()->end()
        ->end();

After:

    $treeBuilder->root('zend', 'array')
        ->children()
            ->arrayNode('logger')
                ->children()
                    ->scalarNode('priority')->defaultValue('INFO')->end()
                    ->booleanNode('log_errors')->defaultFalse()->end()
                ->end()
            ->end()
        ->end();

2. The 'builder' method (in NodeBuilder) has been dropped in favor of an 'append' method (in ArrayNodeDefinition)

Before:

    $treeBuilder->root('doctrine', 'array')
        ->arrayNode('dbal')
            ->builder($this->getDbalConnectionsNode())
        ->end();

After:

    $treeBuilder->root('doctrine', 'array')
        ->children()
            ->arrayNode('dbal')
                ->append($this->getDbalConnectionsNode())
            ->end()
        ->end();

3. The root of a TreeBuilder is now an NodeDefinition (and most probably an ArrayNodeDefinition):

Before:

    $root = $treeBuilder->root('doctrine', 'array');
    $this->addDbalSection($root);

    public function addDbalSection(NodeBuilder $node)
    {
        ...
    }

After:

    $root = $treeBuilder->root('doctrine', 'array');
    $this->addDbalSection($root);

    public function addDbalSection(ArrayNodeDefinition $node)
    {
        ...
    }

4. The NodeBuilder API has changed (this is seldom used):

Before:

    $node = new NodeBuilder('connections', 'array');

After:

The recommended way is to use a tree builder:

    $treeBuilder = new TreeBuilder();
    $node = $treeBuilder->root('connections', 'array');

An other way would be:

    $builder = new NodeBuilder();
    $node = $builder->node('connections', 'array');

Some notes:

- Tree root nodes should most always be array nodes, so this as been made the default:

    $treeBuilder->root('doctrine', 'array') is equivalent to $treeBuilder->root('doctrine')

- There could be more than one ->children() ... ->end() sections. This could help with the readability:

    $treeBuilder->root('doctrine')
        ->children()
            ->scalarNode('default_connection')->end()
        ->end()
        ->fixXmlConfig('type')
        ->children()
            ->arrayNode('types')
                ....
            ->end()
        ->end()
2011-03-17 16:26:15 +01:00
Jordi Boggiano
2ffa8521b5 [Config] fix test on windows 2011-03-09 17:22:43 +01:00
Fabien Potencier
8716c2ad1e merged 2011-03-08 15:43:02 +01:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Fabien Potencier
bbc5f40636 Merge remote branch 'jakzal/FileLocatorTest'
* jakzal/FileLocatorTest:
  [Config] Added missing tests to satisfy 100% test coverage of FileLocator. Made sure that every path returned with locate() is unique.
2011-03-06 10:40:52 +01:00
Jakub Zalas
bdd4194b6f [Config] Added missing tests to satisfy 100% test coverage of FileLocator. Made sure that every path returned with locate() is unique. 2011-03-05 15:24:44 +01:00
Jakub Zalas
61f67d20c8 [Config] Added tests for BooleanNode. 2011-03-05 13:53:07 +01:00
Martin Hason
d231a8a8d5 [Config] [DependencyInjection] removed DependencyInjection dependency in Config, fix tests 2011-02-28 09:19:13 +01:00
Lukas Kahwe Smith
4b3c49550f issues found by static code analysis 2011-02-27 19:34:02 +01:00
Ryan Weaver
026ab6c6ce [Config] Adding an ignoreExtraKeys options, which allows you to let options simply be ignore without throwing a validation exception.
I had thought that this was unnecessary - when would you ever want to just let "extra" options fail silently?

But, the SecurityExtension takes advantage of this by creating two separate config trees. The first tree looks for just one particular value on the configuration array and ignores the rest. So, there *is* a use-case for allowing all extra fields to simply be ignored, though this should not be the norm.
2011-02-18 13:31:14 -06:00
Ryan Weaver
d2971e0f5f [Config] Reverting some meaningless changes that are no longer needed to minimize the true diff of the changes. Increasing the test precision. 2011-02-18 13:08:53 -06:00
Ryan Weaver
6f17b6d58e [Config] Reverting the preventExtraKeys option. This is a revert of functionality that would have allowed "unnamed" children to be added to an array node.
We decided that this is not necessary and that it's leaving too many things wide open. Instead, in these cases where we have an array with unknown items, a prototype should be used.

Further functionality will need to be added later to allow you to specify a few nodes that you *do* know about under an array and then also specify a prototype to catch everything else.
2011-02-18 12:59:27 -06:00
Ryan Weaver
6d24d37b16 [Config] Moving the removal of the key attribute on ArrayNode onto the setKeyAttribute() method per Johannes.
This is more consistent with how this was handled elsewhere, and it really is an "option" on the keyAttribute idea.
2011-02-18 08:41:30 -06:00
Ryan Weaver
48459e9082 [Config] Renaming the key attribute removal property for consistency per Johannes' recommendation. Also fixing a PHPDoc typo per Stof. 2011-02-18 08:38:09 -06:00
Ryan Weaver
d6617f6fba [Config] Renaming NodeBuilder::nodeBuilder() to NodeBuilder::builder() due to the fact that PHP can get confused when you have a __construct() method *and* a method that has the same name as the class (looks like two constructors to PHP). 2011-02-18 07:31:00 -06:00
Ryan Weaver
ea768fe6fc [Config] Making the option to remove a key attribute optional.
This is *usually* what you want (and is defaulted this way). If you have an entry in an array *just* so it can become the key to that entry later, then you shouldn't normally still need it in the resulting array.

The importance of this comes in with validation. Since we're throwing an exception if you have any unrecognized options, the presence of the "key" field in the resulting array will cause issues when it's not needed.
2011-02-18 07:15:59 -06:00
Ryan Weaver
7a9243a220 [Config] Making changes per the recent movement of the Config builder into the Config component. 2011-02-18 06:59:35 -06:00
Ryan Weaver
e7c098e8a2 [DependencyInjection] Renaming allowUnnamedChildren to preventExtraKeys. Also moved the place where validation of extra configs occurs. 2011-02-18 06:52:44 -06:00
Ryan Weaver
fd5cdfc18f [DependencyInjection] Being sure to remove XML-remapped singular options and key attribute options after processing.
This prevents these keys from being validated as extra fields.
2011-02-18 06:52:44 -06:00
Ryan Weaver
f5b1cb18e1 [DependencyInjection] Initial implementation of an allowUnnamedChildren method on NodeBuilder. Also added an "extra field" exception.
This allows for an array node, which has any number of child values not represented by nodes.
2011-02-18 06:51:56 -06:00
Fabien Potencier
6b12c21261 moved DependencyInjection\Configuration to Config\Definition 2011-02-17 16:03:48 +01:00
Victor Berchet
8588d55c11 [Config] Improve the component 2011-02-14 22:05:56 +01:00
Fabien Potencier
5c905beb13 moved common configuration classes to a new Config component 2011-02-13 22:31:50 +01:00
Fabien Potencier
b91f082be5 Revert "moved Resource to the Config component"
This reverts commit f53080860a.

Revert "[Router] config fixes"

This reverts commit 51beecc6f2.

Revert "moved duplicated files to a new Config component"

This reverts commit a8ec9b27f0.
2011-02-10 16:14:12 +01:00
Fabien Potencier
f53080860a moved Resource to the Config component 2011-02-10 16:07:42 +01:00
Fabien Potencier
a8ec9b27f0 moved duplicated files to a new Config component 2011-02-10 03:43:36 +01:00