[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,27 +229,25 @@ class XmlFileLoader extends FileLoader
|
||||
$count = 0;
|
||||
|
||||
// anonymous services as arguments
|
||||
if (false === $nodes = $xml->xpath('//container:argument[@type="service"][not(@id)]')) {
|
||||
return;
|
||||
}
|
||||
foreach ($nodes as $node) {
|
||||
// give it a unique name
|
||||
$node['id'] = sprintf('%s_%d', md5($file), ++$count);
|
||||
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);
|
||||
|
||||
$definitions[(string) $node['id']] = array($node->service, $file, false);
|
||||
$node->service['id'] = (string) $node['id'];
|
||||
$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;
|
||||
}
|
||||
foreach ($nodes as $node) {
|
||||
// give it a unique name
|
||||
$node['id'] = sprintf('%s_%d', md5($file), ++$count);
|
||||
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);
|
||||
|
||||
$definitions[(string) $node['id']] = array($node, $file, true);
|
||||
$node->service['id'] = (string) $node['id'];
|
||||
$definitions[(string) $node['id']] = array($node, $file, true);
|
||||
$node->service['id'] = (string) $node['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// resolve definitions
|
||||
|
Reference in New Issue
Block a user