From 18e3e6fe2012763d3dc0c89540a87f6fa11f9d6c Mon Sep 17 00:00:00 2001 From: Hany el-Kerdany Date: Mon, 4 Aug 2014 10:10:46 +0300 Subject: [PATCH] [DependencyInjection] fixed missing 'factory-class' attribute in XmlDumper output Symfony\Component\DependencyInjection\Dumper\XmlDumper didn't write 'factory-class' XML attribute for definitions on which setFactoryClass() was called. This caused the Container[Builder] to throw an exception when the relevant service is being requested/initiated after loading the dumped XML: `Uncaught Exception Symfony\Component\DependencyInjection\Exception\RuntimeException: "Cannot create service "xxx" from factory method without a factory service or factory class." at ///vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php` Fixed the problem, and updated the relevant test fixture. --- .../Component/DependencyInjection/Dumper/XmlDumper.php | 3 +++ .../DependencyInjection/Tests/Fixtures/xml/services9.xml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index a311af348e..6cdc68fc20 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -119,6 +119,9 @@ class XmlDumper extends Dumper if ($definition->getFactoryMethod()) { $service->setAttribute('factory-method', $definition->getFactoryMethod()); } + if ($definition->getFactoryClass()) { + $service->setAttribute('factory-class', $definition->getFactoryClass()); + } if ($definition->getFactoryService()) { $service->setAttribute('factory-service', $definition->getFactoryService()); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml index 7b99fe2667..de065464c5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml @@ -6,7 +6,7 @@ bar - + foo @@ -35,7 +35,7 @@ %foo_bar% - +