diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index bcbf7d1da7..6ca61d521d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -205,7 +205,7 @@ class Configuration
->treatTrueLike(array())
->fixXmlConfig('namespace')
->arrayNode('namespaces')
- ->containsNameValuePairsWithKeyAttribute('prefix')
+ ->useAttributeAsKey('prefix')
->prototype('scalar')
->beforeNormalization()
->ifTrue(function($v) { return is_array($v) && isset($v['namespace']); })
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Configuration.php
index 2bb11266c2..35c9e3afec 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Configuration.php
@@ -67,7 +67,7 @@ class Configuration
$rootNode
->fixXmlConfig('role', 'role_hierarchy')
->arrayNode('role_hierarchy')
- ->containsNameValuePairsWithKeyAttribute('id')
+ ->useAttributeAsKey('id')
->prototype('array')
->performNoDeepMerging()
->beforeNormalization()->ifString()->then(function($v) { return array('value' => $v); })->end()
@@ -103,7 +103,7 @@ class Configuration
->end()
->fixXmlConfig('attribute')
->arrayNode('attributes')
- ->containsNameValuePairsWithKeyAttribute('key')
+ ->useAttributeAsKey('key')
->prototype('scalar')
->beforeNormalization()
->ifTrue(function($v) { return is_array($v) && isset($v['pattern']); })
@@ -122,6 +122,8 @@ class Configuration
$rootNode
->fixXmlConfig('firewall')
->arrayNode('firewalls')
+ ->isRequired()
+ ->requiresAtLeastOneElement()
->disallowNewKeysInSubsequentConfigs()
->useAttributeAsKey('name')
->prototype('array')
@@ -183,6 +185,7 @@ class Configuration
->fixXmlConfig('provider')
->arrayNode('providers')
->disallowNewKeysInSubsequentConfigs()
+ ->isRequired()
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
->prototype('array')
@@ -220,10 +223,13 @@ class Configuration
$rootNode
->fixXmlConfig('encoder')
->arrayNode('encoders')
+ ->requiresAtLeastOneElement()
->useAttributeAsKey('class')
->prototype('array')
+ ->canBeUnset()
+ ->performNoDeepMerging()
->beforeNormalization()->ifString()->then(function($v) { return array('algorithm' => $v); })->end()
- ->scalarNode('algorithm')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('algorithm')->cannotBeEmpty()->end()
->booleanNode('ignore_case')->end()
->booleanNode('encode_as_base64')->end()
->scalarNode('iterations')->end()
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
index 561bf55747..0a6a0fa5cd 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -470,7 +470,7 @@ class SecurityExtension extends Extension
$definition = $container->register($name, '%security.user.provider.in_memory.class%');
$definition->setPublic(false);
foreach ($provider['users'] as $username => $user) {
- $userId = $name.'_'.md5(json_encode(array($username, $user['password'], $user['roles'])));
+ $userId = $name.'_'.$username;
$container
->register($userId, 'Symfony\Component\Security\Core\User\User')
@@ -486,7 +486,7 @@ class SecurityExtension extends Extension
protected function getUserProviderId($name)
{
- return 'security.authentication.provider.'.$name;
+ return 'security.user.provider.'.$name;
}
protected function createExceptionListener($container, $config, $id, $defaultEntryPoint)
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/access.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/access.php
deleted file mode 100644
index 9fee767720..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/access.php
+++ /dev/null
@@ -1,8 +0,0 @@
-loadFromExtension('security', 'config', array(
- 'access_control' => array(
- array('path' => '/blog/524', 'role' => 'ROLE_USER', 'requires_channel' => 'https'),
- array('path' => '/blog/.*', 'attributes' => array('_controller' => '.*\\BlogBundle\\.*'), 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY'),
- ),
-));
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/container1.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/container1.php
new file mode 100644
index 0000000000..e5b1572eb1
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/container1.php
@@ -0,0 +1,52 @@
+loadFromExtension('security', 'config', array(
+ 'providers' => array(
+ 'default' => array(
+ 'users' => array(
+ 'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'),
+ ),
+ ),
+ 'digest' => array(
+ 'users' => array(
+ 'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER, ROLE_ADMIN'),
+ ),
+ ),
+ 'basic' => array(
+ 'users' => array(
+ 'foo' => array('password' => '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', 'roles' => 'ROLE_SUPER_ADMIN'),
+ 'bar' => array('password' => '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', 'roles' => array('ROLE_USER', 'ROLE_ADMIN')),
+ ),
+ ),
+ 'doctrine' => array(
+ 'entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')
+ ),
+ 'service' => array(
+ 'id' => 'user.manager',
+ ),
+ ),
+
+ 'firewalls' => array(
+ 'simple' => array('pattern' => '/login', 'security' => false),
+ 'secure' => array('stateless' => true,
+ 'http_basic' => true,
+ 'http_digest' => true,
+ 'form_login' => true,
+ 'anonymous' => true,
+ 'switch_user' => true,
+ 'x509' => true,
+ 'logout' => true,
+ ),
+ ),
+
+ 'access_control' => array(
+ array('path' => '/blog/524', 'role' => 'ROLE_USER', 'requires_channel' => 'https'),
+ array('path' => '/blog/.*', 'attributes' => array('_controller' => '.*\\BlogBundle\\.*'), 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY'),
+ ),
+
+ 'role_hierarchy' => array(
+ 'ROLE_ADMIN' => 'ROLE_USER',
+ 'ROLE_SUPER_ADMIN' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'),
+ 'ROLE_REMOTE' => 'ROLE_USER,ROLE_ADMIN',
+ ),
+));
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/firewall.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/firewall.php
deleted file mode 100644
index 56240fcdd2..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/firewall.php
+++ /dev/null
@@ -1,24 +0,0 @@
-loadFromExtension('security', 'config', array(
- 'providers' => array(
- 'basic' => array(
- 'users' => array(
- 'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'),
- ),
- ),
- ),
-
- 'firewalls' => array(
- 'simple' => array('pattern' => '/login', 'security' => false),
- 'secure' => array('stateless' => true,
- 'http_basic' => true,
- 'http_digest' => true,
- 'form_login' => true,
- 'anonymous' => true,
- 'switch_user' => true,
- 'x509' => true,
- 'logout' => true,
- ),
- )
-));
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/hierarchy.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/hierarchy.php
deleted file mode 100644
index 49127bc0f9..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/hierarchy.php
+++ /dev/null
@@ -1,9 +0,0 @@
-loadFromExtension('security', 'config', array(
- 'role_hierarchy' => array(
- 'ROLE_ADMIN' => 'ROLE_USER',
- 'ROLE_SUPER_ADMIN' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'),
- 'ROLE_REMOTE' => 'ROLE_USER,ROLE_ADMIN',
- )
-));
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php
index 988640fb28..e061b541f4 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php
@@ -3,12 +3,17 @@
$this->load('merge_import.php', $container);
$container->loadFromExtension('security', 'config', array(
+ 'providers' => array(
+ 'default' => array('id' => 'foo'),
+ ),
+
'firewalls' => array(
'main' => array(
'form_login' => false,
'http_basic' => null,
),
),
+
'role_hierarchy' => array(
'FOO' => array('MOO'),
)
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/provider.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/provider.php
deleted file mode 100644
index 83f4f192d6..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/provider.php
+++ /dev/null
@@ -1,24 +0,0 @@
-loadFromExtension('security', 'config', array(
- 'providers' => array(
- 'digest' => array(
- 'users' => array(
- 'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER, ROLE_ADMIN'),
- ),
- ),
- 'basic' => array(
- 'password_encoder' => 'sha1',
- 'users' => array(
- 'foo' => array('password' => '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', 'roles' => 'ROLE_SUPER_ADMIN'),
- 'bar' => array('password' => '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', 'roles' => array('ROLE_USER', 'ROLE_ADMIN')),
- ),
- ),
- 'doctrine' => array(
- 'entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')
- ),
- 'service' => array(
- 'id' => 'user.manager',
- ),
- )
-));
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/access.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/access.xml
deleted file mode 100644
index 2ca9f5b9d0..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/access.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/provider.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/container1.xml
similarity index 51%
rename from src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/provider.xml
rename to src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/container1.xml
index e4cbf6d598..ccf38ec861 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/provider.xml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/container1.xml
@@ -1,4 +1,4 @@
-
+
+
+
+
+
-
@@ -21,5 +24,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ROLE_USER
+ ROLE_USER,ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH
+ ROLE_USER,ROLE_ADMIN
+
+
+
+
+
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/firewall.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/firewall.xml
deleted file mode 100644
index b3e7987382..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/firewall.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/hierarchy.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/hierarchy.xml
deleted file mode 100644
index 4c8985a791..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/hierarchy.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
- ROLE_USER
- ROLE_USER,ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH
- ROLE_USER,ROLE_ADMIN
-
-
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/merge.xml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/merge.xml
index 36f7b4de72..94087dcdc4 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/merge.xml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/xml/merge.xml
@@ -10,6 +10,8 @@
+
+
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/access.yml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/access.yml
deleted file mode 100644
index 6f531b0cc9..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/access.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-security.config:
- access_control:
- - { path: /blog/524, role: ROLE_USER, requires_channel: https }
- -
- path: /blog/.*
- attributes: { _controller: .*\\BlogBundle\\.* }
- role: IS_AUTHENTICATED_ANONYMOUSLY
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/container1.yml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/container1.yml
new file mode 100644
index 0000000000..24165ddcfd
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/container1.yml
@@ -0,0 +1,41 @@
+security.config:
+ providers:
+ default:
+ users:
+ foo: { password: foo, roles: ROLE_USER }
+ digest:
+ users:
+ foo: { password: foo, roles: 'ROLE_USER, ROLE_ADMIN' }
+ basic:
+ password_encoder: sha1
+ users:
+ foo: { password: 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, roles: ROLE_SUPER_ADMIN }
+ bar: { password: 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, roles: [ROLE_USER, ROLE_ADMIN] }
+ doctrine:
+ entity: { class: SecurityBundle:User, property: username }
+ service:
+ id: user.manager
+
+ firewalls:
+ simple: { pattern: /login, security: false }
+ secure:
+ stateless: true
+ http_basic: true
+ http_digest: true
+ form_login: true
+ anonymous: true
+ switch_user: true
+ x509: true
+ logout: true
+
+ role_hierarchy:
+ ROLE_ADMIN: ROLE_USER
+ ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
+ ROLE_REMOTE: ROLE_USER,ROLE_ADMIN
+
+ access_control:
+ - { path: /blog/524, role: ROLE_USER, requires_channel: https }
+ -
+ path: /blog/.*
+ attributes: { _controller: .*\\BlogBundle\\.* }
+ role: IS_AUTHENTICATED_ANONYMOUSLY
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/firewall.yml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/firewall.yml
deleted file mode 100644
index 578485574e..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/firewall.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-security.config:
- providers:
- basic:
- users:
- foo: { password: foo, roles: ROLE_USER }
-
- firewalls:
- simple: { pattern: /login, security: false }
- secure:
- stateless: true
- http_basic: true
- http_digest: true
- form_login: true
- anonymous: true
- switch_user: true
- x509: true
- logout: true
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/hierarchy.yml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/hierarchy.yml
deleted file mode 100644
index 60cb87efb5..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/hierarchy.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-security.config:
- role_hierarchy:
- ROLE_ADMIN: ROLE_USER
- ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
- ROLE_REMOTE: ROLE_USER,ROLE_ADMIN
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/merge.yml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/merge.yml
index a42fc99fab..cd6b673497 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/merge.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/merge.yml
@@ -2,10 +2,13 @@ imports:
- { resource: merge_import.yml }
security.config:
+ providers:
+ default: { id: foo }
+
firewalls:
main:
form_login: false
http_basic: ~
-
+
role_hierarchy:
FOO: [MOO]
\ No newline at end of file
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/provider.yml b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/provider.yml
deleted file mode 100644
index 16a975f37c..0000000000
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/yml/provider.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-security.config:
- providers:
- digest:
- users:
- foo: { password: foo, roles: 'ROLE_USER, ROLE_ADMIN' }
-
- basic:
- password_encoder: sha1
- users:
- foo: { password: 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, roles: ROLE_SUPER_ADMIN }
- bar: { password: 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, roles: [ROLE_USER, ROLE_ADMIN] }
-
- doctrine:
- entity: { class: SecurityBundle:User, property: username }
-
- service:
- id: user.manager
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
index 73df009691..5c6af33187 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
@@ -20,7 +20,7 @@ abstract class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
public function testRolesHierarchy()
{
- $container = $this->getContainer('hierarchy');
+ $container = $this->getContainer('container1');
$this->assertEquals(array(
'ROLE_ADMIN' => array('ROLE_USER'),
'ROLE_SUPER_ADMIN' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'),
@@ -30,22 +30,20 @@ abstract class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
public function testUserProviders()
{
- $container = $this->getContainer('provider');
+ $container = $this->getContainer('container1');
- $providers = array_values(array_filter($container->getServiceIds(), function ($key) { return 0 === strpos($key, 'security.authentication.provider.'); }));
+ $providers = array_values(array_filter($container->getServiceIds(), function ($key) { return 0 === strpos($key, 'security.user.provider.'); }));
$expectedProviders = array(
- 'security.authentication.provider.digest',
- 'security.authentication.provider.digest_23374fce51fe846516ff85bfa9add8fe',
- 'security.authentication.provider.basic',
- 'security.authentication.provider.basic_745e8583f784c83c4b4208fd281001f3',
- 'security.authentication.provider.basic_af4bcce7246fb064b8e219034043d88a',
- 'security.authentication.provider.doctrine',
- 'security.authentication.provider.service',
- 'security.authentication.provider.anonymous',
- 'security.authentication.provider.dao',
- 'security.authentication.provider.pre_authenticated',
- 'security.authentication.provider.rememberme',
+ 'security.user.provider.default',
+ 'security.user.provider.default_foo',
+ 'security.user.provider.digest',
+ 'security.user.provider.digest_foo',
+ 'security.user.provider.basic',
+ 'security.user.provider.basic_foo',
+ 'security.user.provider.basic_bar',
+ 'security.user.provider.doctrine',
+ 'security.user.provider.service',
);
$this->assertEquals(array(), array_diff($expectedProviders, $providers));
@@ -54,7 +52,7 @@ abstract class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
public function testFirewalls()
{
- $container = $this->getContainer('firewall');
+ $container = $this->getContainer('container1');
$arguments = $container->getDefinition('security.firewall.map')->getArguments();
$listeners = array();
@@ -82,7 +80,7 @@ abstract class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
public function testAccess()
{
- $container = $this->getContainer('access');
+ $container = $this->getContainer('container1');
$rules = array();
foreach ($container->getDefinition('security.access_map')->getMethodCalls() as $call) {
diff --git a/src/Symfony/Component/DependencyInjection/Configuration/ArrayNode.php b/src/Symfony/Component/DependencyInjection/Configuration/ArrayNode.php
index f39ccc2ce9..a9ef74daec 100644
--- a/src/Symfony/Component/DependencyInjection/Configuration/ArrayNode.php
+++ b/src/Symfony/Component/DependencyInjection/Configuration/ArrayNode.php
@@ -225,7 +225,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
if ($child->isRequired()) {
throw new InvalidConfigurationException(sprintf(
'The node at path "%s" must be configured.',
- $this->getPath()
+ $this->getPath().'.'.$name
));
}
@@ -352,19 +352,15 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
continue;
}
- try {
- if (null !== $this->prototype) {
- $this->prototype->setName($k);
- $leftSide[$k] = $this->prototype->merge($leftSide[$k], $v);
- } else {
- if (!isset($this->children[$k])) {
- throw new \RuntimeException('merge() expects a normalized config array.');
- }
-
- $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v);
+ if (null !== $this->prototype) {
+ $this->prototype->setName($k);
+ $leftSide[$k] = $this->prototype->merge($leftSide[$k], $v);
+ } else {
+ if (!isset($this->children[$k])) {
+ throw new \RuntimeException('merge() expects a normalized config array.');
}
- } catch (UnsetKeyException $unset) {
- unset($leftSide[$k]);
+
+ $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v);
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php b/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php
index 3c9686448e..f4c61891bd 100644
--- a/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php
@@ -92,31 +92,6 @@ class ExprBuilder
return $this;
}
- /**
- * Sets a closure replacing the key with an attribute of the value when it is an array.
- *
- * @param string $attribute
- *
- * @return Symfony\Component\DependencyInjection\Configuration\Builder\ExprBuilder
- */
- public function thenReplaceKeyWithAttribute($attribute)
- {
- $this->thenPart = function($v) use ($attribute) {
- $newValue = array();
- foreach ($v as $k => $oldValue) {
- if (is_array($oldValue) && isset($oldValue[$attribute])) {
- $k = $oldValue[$attribute];
- }
-
- $newValue[$k] = $oldValue;
- }
-
- return $newValue;
- };
-
- return $this;
- }
-
/**
* Sets a closure returning an empty array.
*
diff --git a/src/Symfony/Component/DependencyInjection/Configuration/Builder/NodeBuilder.php b/src/Symfony/Component/DependencyInjection/Configuration/Builder/NodeBuilder.php
index 285afa0c44..7d2dec2df0 100644
--- a/src/Symfony/Component/DependencyInjection/Configuration/Builder/NodeBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/Configuration/Builder/NodeBuilder.php
@@ -152,25 +152,6 @@ class NodeBuilder
return $this;
}
- /**
- * Sets the attribute to use as key of the array.
- *
- * @param string $attribute The name of the attribute
- *
- * @return Symfony\Component\DependencyInjection\Configuration\Builder\NodeBuilder
- */
- public function containsNameValuePairsWithKeyAttribute($attribute)
- {
- $this->beforeNormalization()
- ->ifArray()
- ->thenReplaceKeyWithAttribute($attribute)
- ;
-
- $this->useAttributeAsKey($attribute);
-
- return $this;
- }
-
/**
* Requires the node to have at least one element.
*
diff --git a/src/Symfony/Component/DependencyInjection/Configuration/Builder/TreeBuilder.php b/src/Symfony/Component/DependencyInjection/Configuration/Builder/TreeBuilder.php
index 9c7a56b73d..71a0132cc9 100644
--- a/src/Symfony/Component/DependencyInjection/Configuration/Builder/TreeBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/Configuration/Builder/TreeBuilder.php
@@ -128,6 +128,7 @@ class TreeBuilder
$configNode->addEquivalentValue(null, $node->nullEquivalent);
$configNode->addEquivalentValue(true, $node->trueEquivalent);
$configNode->addEquivalentValue(false, $node->falseEquivalent);
+ $configNode->setRequired($node->required);
}
/**
@@ -146,6 +147,7 @@ class TreeBuilder
$configNode->addEquivalentValue(true, $node->trueEquivalent);
$configNode->addEquivalentValue(false, $node->falseEquivalent);
$configNode->setPerformDeepMerging($node->performDeepMerging);
+ $configNode->setRequired($node->required);
if (null !== $node->key) {
$configNode->setKeyAttribute($node->key);
diff --git a/src/Symfony/Component/DependencyInjection/Configuration/NodeInterface.php b/src/Symfony/Component/DependencyInjection/Configuration/NodeInterface.php
index 70271946b4..6757777091 100644
--- a/src/Symfony/Component/DependencyInjection/Configuration/NodeInterface.php
+++ b/src/Symfony/Component/DependencyInjection/Configuration/NodeInterface.php
@@ -19,4 +19,5 @@ interface NodeInterface
function getDefaultValue();
function normalize($value);
function merge($leftSide, $rightSide);
+ function finalize($value);
}
\ No newline at end of file