Navigation Menu

Skip to content

Commit

Permalink
Merge branch '2.0' into 2.1
Browse files Browse the repository at this point in the history
* 2.0:
  [DependencyInjection] fixed the creation of synthetic services in ContainerBuilder
  [Security] PHPDoc in SecurityEvents
  [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.0.23-DEV

Conflicts:
	src/Symfony/Component/DependencyInjection/ContainerBuilder.php
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/Yaml/Inline.php
	src/Symfony/Component/Yaml/Tests/InlineTest.php
  • Loading branch information
fabpot committed Jan 22, 2013
2 parents 96e5a16 + 3a819bf commit 5895e96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ContainerBuilder.php
Expand Up @@ -734,19 +734,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()) {
Expand Down
11 changes: 11 additions & 0 deletions Tests/ContainerBuilderTest.php
Expand Up @@ -319,6 +319,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
*/
Expand Down

0 comments on commit 5895e96

Please sign in to comment.