[DependencyInjection] fixed anonymous services handling in XmlFileLoader
Previous to this commit, it was not possible to have anonymous services as arguments AND anonymous services in custom configs
This commit is contained in:
parent
1244158ceb
commit
23b5e60436
@ -229,9 +229,7 @@ class XmlFileLoader extends FileLoader
|
||||
$count = 0;
|
||||
|
||||
// anonymous services as arguments
|
||||
if (false === $nodes = $xml->xpath('//container:argument[@type="service"][not(@id)]')) {
|
||||
return;
|
||||
}
|
||||
if (false !== $nodes = $xml->xpath('//container:argument[@type="service"][not(@id)]')) {
|
||||
foreach ($nodes as $node) {
|
||||
// give it a unique name
|
||||
$node['id'] = sprintf('%s_%d', md5($file), ++$count);
|
||||
@ -239,11 +237,10 @@ class XmlFileLoader extends FileLoader
|
||||
$definitions[(string) $node['id']] = array($node->service, $file, false);
|
||||
$node->service['id'] = (string) $node['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// anonymous services "in the wild"
|
||||
if (false === $nodes = $xml->xpath('//container:services/container:service[not(@id)]')) {
|
||||
return;
|
||||
}
|
||||
if (false !== $nodes = $xml->xpath('//container:services/container:service[not(@id)]')) {
|
||||
foreach ($nodes as $node) {
|
||||
// give it a unique name
|
||||
$node['id'] = sprintf('%s_%d', md5($file), ++$count);
|
||||
@ -251,6 +248,7 @@ class XmlFileLoader extends FileLoader
|
||||
$definitions[(string) $node['id']] = array($node, $file, true);
|
||||
$node->service['id'] = (string) $node['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// resolve definitions
|
||||
krsort($definitions);
|
||||
|
Reference in New Issue
Block a user