From 177cea0ee1cf3c72eac7377537d5db0979cc202d Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Mon, 16 Apr 2018 10:13:29 +0100 Subject: [PATCH] Support nested configuration on adapters --- .../FrameworkBundle/DependencyInjection/Configuration.php | 5 ++--- .../Resources/config/schema/symfony-1.0.xsd | 7 +------ .../DependencyInjection/Fixtures/php/messenger_adapter.php | 2 +- .../DependencyInjection/Fixtures/xml/messenger_adapter.xml | 6 +++++- .../DependencyInjection/Fixtures/yml/messenger_adapter.yml | 3 ++- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index c488af15ad..d3c37d636b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1030,9 +1030,8 @@ class Configuration implements ConfigurationInterface ->scalarNode('dsn')->end() ->arrayNode('options') ->normalizeKeys(false) - ->useAttributeAsKey('name') - ->defaultValue(array()) - ->prototype('variable') + ->defaultValue(array()) + ->prototype('variable') ->end() ->end() ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 3fbfaa5d9a..06b100f08e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -371,17 +371,12 @@ - + - - - - - diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_adapter.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_adapter.php index 5e8608e4e8..665211cd0e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_adapter.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/messenger_adapter.php @@ -6,7 +6,7 @@ $container->loadFromExtension('framework', array( 'default' => 'amqp://localhost/%2f/messages', 'customised' => array( 'dsn' => 'amqp://localhost/%2f/messages?exchange_name=exchange_name', - 'options' => array('queue_name' => 'Queue'), + 'options' => array('queue' => array('name' => 'Queue')), ), ), ), diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_adapter.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_adapter.xml index 830ba48a9c..2fa6244dd9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_adapter.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/messenger_adapter.xml @@ -9,7 +9,11 @@ - + + + Queue + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_adapter.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_adapter.yml index 2ec24e9aa1..d774cb87f2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_adapter.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/messenger_adapter.yml @@ -5,4 +5,5 @@ framework: customised: dsn: 'amqp://localhost/%2f/messages?exchange_name=exchange_name' options: - queue_name: Queue + queue: + name: Queue diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index cca0295230..0f81720541 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -557,7 +557,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertEquals(array(new Reference('messenger.adapter_factory'), 'createSender'), $senderFactory); $this->assertCount(2, $senderArguments); $this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $senderArguments[0]); - $this->assertSame(array('queue_name' => 'Queue'), $senderArguments[1]); + $this->assertSame(array('queue' => array('name' => 'Queue')), $senderArguments[1]); $this->assertTrue($container->hasDefinition('messenger.receiver.customised')); $receiverFactory = $container->getDefinition('messenger.receiver.customised')->getFactory(); @@ -566,7 +566,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertEquals(array(new Reference('messenger.adapter_factory'), 'createReceiver'), $receiverFactory); $this->assertCount(2, $receiverArguments); $this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $receiverArguments[0]); - $this->assertSame(array('queue_name' => 'Queue'), $receiverArguments[1]); + $this->assertSame(array('queue' => array('name' => 'Queue')), $receiverArguments[1]); } public function testTranslator()