Permalink
Browse files

Merge branch '2.1'

* 2.1:
  [DependencyInjection] fixed the creation of synthetic services in ContainerBuilder
  [Security] PHPDoc in SecurityEvents
  Fix typos in README
  Added an error message in the DebugClassLoader when using / instead of \.
  KNOWN_ISSUES with php 5.3.16
  [FrameworkBundle] fixed Client::doRequest that must call its parent method (closes #6737)
  [Yaml] fixed ignored text when parsing an inlined mapping or sequence (closes #6786)
  [Yaml] fixed #6773
  [Yaml] fixed #6770
  bumped Symfony version to 2.1.8-DEV
  bumped Symfony version to 2.0.23-DEV

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Client.php
	src/Symfony/Component/HttpKernel/Kernel.php
  • Loading branch information...
2 parents f01c1a4 + 5895e96 commit 7a5d1346ef09f297dc58395f63163c39be07dccd @fabpot fabpot committed Jan 23, 2013
Showing with 17 additions and 3 deletions.
  1. +6 −3 ContainerBuilder.php
  2. +11 −0 Tests/ContainerBuilderTest.php
View
9 ContainerBuilder.php
@@ -834,19 +834,22 @@ public function findDefinition($id)
*
* @throws RuntimeException When the scope is inactive
* @throws RuntimeException When the factory definition is incomplete
+ * @throws RuntimeException When the service is a synthetic service
* @throws InvalidArgumentException When configure callable is not callable
*/
private function createService(Definition $definition, $id)
{
+ if ($definition->isSynthetic()) {
+ throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
+ }
+
$parameterBag = $this->getParameterBag();
if (null !== $definition->getFile()) {
require_once $parameterBag->resolveValue($definition->getFile());
}
- $arguments = $this->resolveServices(
- $parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments()))
- );
+ $arguments = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())));
if (null !== $definition->getFactoryMethod()) {
if (null !== $definition->getFactoryClass()) {
View
11 Tests/ContainerBuilderTest.php
@@ -317,6 +317,17 @@ public function testCreateServiceConfigurator()
}
/**
+ * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService
+ * @expectedException \RuntimeException
+ */
+ public function testCreateSyntheticService()
+ {
+ $builder = new ContainerBuilder();
+ $builder->register('foo', 'FooClass')->setSynthetic(true);
+ $builder->get('foo');
+ }
+
+ /**
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::resolveServices
*/
public function testResolveServices()

0 comments on commit 7a5d134

Please sign in to comment.