浏览代码

[DoctrineMongoDBBundle] Adding is_bundle node and rearranging a few small things to match pull request 99 for the Doctrine Configuration class

Ryan Weaver 14 年之前
父节点
当前提交
4c947c251b

+ 6 - 5
src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/Configuration.php

@@ -123,18 +123,19 @@ class Configuration
         $node
             ->useAttributeAsKey('name')
             ->prototype('array')
-                // I believe that "null" should *not* set the type
-                // it's guessed in AbstractDoctrineExtension::detectMetadataDriver
-                ->treatNullLike(array())
                 ->beforeNormalization()
                     // if it's not an array, then the scalar is the type key
-                    ->ifTrue(function($v) { return !is_array($v); })
-                    ->then(function($v){ return array('type' => $v); })
+                    ->ifString()
+                    ->then(function($v) { return array ('type' => $v); })
                 ->end()
+                // I believe that "null" should *not* set the type
+                // it's guessed in AbstractDoctrineExtension::detectMetadataDriver
+                ->treatNullLike(array())
                 ->scalarNode('type')->end()
                 ->scalarNode('dir')->end()
                 ->scalarNode('prefix')->end()
                 ->scalarNode('alias')->end()
+                ->booleanNode('is_bundle')->end()
                 ->performNoDeepMerging()
             ->end()
         ;

+ 1 - 0
src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/ConfigurationTest.php

@@ -116,6 +116,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
                             'dir'       => '%kernel.cache_dir%',
                             'prefix'    => 'prefix_val',
                             'alias'     => 'alias_val',
+                            'is_bundle' => false,
                         )
                     ),
                     'metadata_cache_driver' => array(

+ 1 - 0
src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/DependencyInjection/Fixtures/config/yml/full.yml

@@ -44,5 +44,6 @@ doctrine_mongo_db:
                     dir:    %kernel.cache_dir%
                     prefix: prefix_val
                     alias:  alias_val
+                    is_bundle: false
             metadata_cache_driver: apc