Skip to content
This repository was archived by the owner on Feb 6, 2022. It is now read-only.

Commit 5e1a90f

Browse files
committed
bug #130 Fix the BC layer for the switch to multiple delivery addresses (stof)
This PR was merged into the 2.3-dev branch. Discussion ---------- Fix the BC layer for the switch to multiple delivery addresses Closes #129 Commits ------- 20cc5e8 Fix the BC layer for the switch to multiple delivery addresses
2 parents de5a2dd + 20cc5e8 commit 5e1a90f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\SwiftmailerBundle\DependencyInjection;
1313

14+
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1415
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1516
use Symfony\Component\Config\Definition\ConfigurationInterface;
1617

@@ -88,6 +89,22 @@ private function getMailersNode()
8889
->requiresAtLeastOneElement()
8990
->useAttributeAsKey('name')
9091
->prototype('array')
92+
// BC layer for "delivery_address: null" (the case of a string goes through the XML normalization too)
93+
->beforeNormalization()
94+
->ifTrue(function ($v) {
95+
return array_key_exists('delivery_address', $v) && null === $v['delivery_address'];
96+
})
97+
->then(function ($v) {
98+
@trigger_error('The swiftmailer.delivery_address configuration key is deprecated since version 2.3.10 and will be removed in 3.0. Use the swiftmailer.delivery_addresses configuration key instead (or remove the empty setting)', E_USER_DEPRECATED);
99+
unset($v['delivery_address']);
100+
101+
if (!isset($v['delivery_addresses'])) {
102+
$v['delivery_addresses'] = array();
103+
}
104+
105+
return $v;
106+
})
107+
->end()
91108
->children()
92109
->scalarNode('url')->defaultNull()->end()
93110
->scalarNode('transport')->defaultValue('smtp')->end()
@@ -113,6 +130,7 @@ private function getMailersNode()
113130
->end()
114131
->scalarNode('sender_address')->end()
115132
->arrayNode('delivery_addresses')
133+
->performNoDeepMerging()
116134
->beforeNormalization()
117135
->ifArray()
118136
->then(function ($v) { return array_values($v); })

0 commit comments

Comments
 (0)