Commit 1eae1771 authored by catch's avatar catch

Issue #1879410 by fabpot: Update Symfony dependency.

parent 15f0171d
......@@ -366,12 +366,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/ClassLoader",
"reference": "329e3c07fd7222160c647013d4dc936a76743ff6"
"reference": "0730d0f8f99cfeafbc23271f1e87f54da15f1e06"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/ClassLoader/archive/329e3c07fd7222160c647013d4dc936a76743ff6.zip",
"reference": "329e3c07fd7222160c647013d4dc936a76743ff6",
"url": "https://github.com/symfony/ClassLoader/archive/0730d0f8f99cfeafbc23271f1e87f54da15f1e06.zip",
"reference": "0730d0f8f99cfeafbc23271f1e87f54da15f1e06",
"shasum": ""
},
"require": {
......@@ -380,7 +380,7 @@
"require-dev": {
"symfony/finder": "2.2.*"
},
"time": "2012-11-19 12:58:52",
"time": "2013-01-04 16:58:00",
"type": "library",
"extra": {
"branch-alias": {
......@@ -417,12 +417,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection",
"reference": "e2713da6f3713eba1bc26dfeeaa7aefde8914676"
"reference": "13b47742e1ef22aed78132e5e0930d28571142a4"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/DependencyInjection/archive/e2713da6f3713eba1bc26dfeeaa7aefde8914676.zip",
"reference": "e2713da6f3713eba1bc26dfeeaa7aefde8914676",
"url": "https://github.com/symfony/DependencyInjection/archive/13b47742e1ef22aed78132e5e0930d28571142a4.zip",
"reference": "13b47742e1ef22aed78132e5e0930d28571142a4",
"shasum": ""
},
"require": {
......@@ -436,7 +436,7 @@
"symfony/yaml": "2.2.*",
"symfony/config": "2.2.*"
},
"time": "2012-11-19 12:58:52",
"time": "2013-01-04 16:58:00",
"type": "library",
"extra": {
"branch-alias": {
......@@ -473,12 +473,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher",
"reference": "eb290a447c0af5bea0d3de5d95d498afd8c82f89"
"reference": "0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/EventDispatcher/archive/eb290a447c0af5bea0d3de5d95d498afd8c82f89.zip",
"reference": "eb290a447c0af5bea0d3de5d95d498afd8c82f89",
"url": "https://github.com/symfony/EventDispatcher/archive/0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc.zip",
"reference": "0fcc9fa82fa3ea7ec2605af2e8137698fbaca3dc",
"shasum": ""
},
"require": {
......@@ -491,7 +491,7 @@
"symfony/dependency-injection": "2.2.*",
"symfony/http-kernel": "2.2.*"
},
"time": "2012-11-13 14:08:04",
"time": "2013-01-04 17:02:19",
"type": "library",
"extra": {
"branch-alias": {
......@@ -528,18 +528,18 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation",
"reference": "067c310fe4d0691a24adc97f39500233a58e42cb"
"reference": "5aa0119417f1fc8de7513d9432dd2f43f9d9e97b"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/HttpFoundation/archive/067c310fe4d0691a24adc97f39500233a58e42cb.zip",
"reference": "067c310fe4d0691a24adc97f39500233a58e42cb",
"url": "https://github.com/symfony/HttpFoundation/archive/5aa0119417f1fc8de7513d9432dd2f43f9d9e97b.zip",
"reference": "5aa0119417f1fc8de7513d9432dd2f43f9d9e97b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-12-06 15:23:16",
"time": "2013-01-04 17:02:19",
"type": "library",
"extra": {
"branch-alias": {
......@@ -579,12 +579,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel",
"reference": "dbd6b331aab91deb9e97307eac666b77a0879e07"
"reference": "ce164c088666b80ffc116173065d504055414137"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/HttpKernel/archive/dbd6b331aab91deb9e97307eac666b77a0879e07.zip",
"reference": "dbd6b331aab91deb9e97307eac666b77a0879e07",
"url": "https://github.com/symfony/HttpKernel/archive/ce164c088666b80ffc116173065d504055414137.zip",
"reference": "ce164c088666b80ffc116173065d504055414137",
"shasum": ""
},
"require": {
......@@ -611,7 +611,7 @@
"symfony/dependency-injection": "2.2.*",
"symfony/finder": "2.2.*"
},
"time": "2012-12-06 13:04:11",
"time": "2013-01-04 16:58:00",
"type": "library",
"extra": {
"branch-alias": {
......@@ -691,12 +691,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing",
"reference": "17109bfef57e52b35d76db4d35b3b66b1d176701"
"reference": "87a66890450658ccac99702ac5e4f002ece9e23e"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Routing/archive/17109bfef57e52b35d76db4d35b3b66b1d176701.zip",
"reference": "17109bfef57e52b35d76db4d35b3b66b1d176701",
"url": "https://github.com/symfony/Routing/archive/87a66890450658ccac99702ac5e4f002ece9e23e.zip",
"reference": "87a66890450658ccac99702ac5e4f002ece9e23e",
"shasum": ""
},
"require": {
......@@ -713,7 +713,7 @@
"symfony/config": "2.2.*",
"symfony/yaml": "2.2.*"
},
"time": "2012-12-05 15:37:03",
"time": "2012-12-28 13:21:48",
"type": "library",
"extra": {
"branch-alias": {
......@@ -750,18 +750,18 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/Serializer",
"reference": "60abc7e72a5198192c42fc07bb8c1e3082e7229e"
"reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Serializer/archive/60abc7e72a5198192c42fc07bb8c1e3082e7229e.zip",
"reference": "60abc7e72a5198192c42fc07bb8c1e3082e7229e",
"url": "https://github.com/symfony/Serializer/archive/ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0.zip",
"reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-11-17 17:07:16",
"time": "2012-12-19 07:09:49",
"type": "library",
"extra": {
"branch-alias": {
......@@ -798,18 +798,18 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml",
"reference": "bed4fddc24392513e01b32a78d600b1272ed9a6c"
"reference": "365b4df7802b9bb93084d2cc9a51fe88b488f956"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Yaml/archive/bed4fddc24392513e01b32a78d600b1272ed9a6c.zip",
"reference": "bed4fddc24392513e01b32a78d600b1272ed9a6c",
"url": "https://github.com/symfony/Yaml/archive/365b4df7802b9bb93084d2cc9a51fe88b488f956.zip",
"reference": "365b4df7802b9bb93084d2cc9a51fe88b488f956",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2012-11-13 14:08:04",
"time": "2012-12-19 07:09:49",
"type": "library",
"extra": {
"branch-alias": {
......
......@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a::getLoader();
return ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425::getLoader();
......@@ -2,7 +2,7 @@
// autoload_real.php generated by Composer
class ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a
class ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425
{
private static $loader;
......@@ -15,13 +15,13 @@ public static function loadClassLoader($class)
public static function getLoader()
{
if (null !== static::$loader) {
return static::$loader;
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a', 'loadClassLoader'));
static::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit23a41d5f637bb8e297fc063ef4ab931a', 'loadClassLoader'));
spl_autoload_register(array('ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425', 'loadClassLoader'));
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit4f0cafaacf65c45167c785b9f087e425', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
......
This diff is collapsed.
......@@ -57,6 +57,9 @@ class ApcClassLoader
* @param string $prefix The APC namespace prefix to use.
* @param object $decorated A class loader object that implements the findFile() method.
*
* @throws \RuntimeException
* @throws \InvalidArgumentException
*
* @api
*/
public function __construct($prefix, $decorated)
......
......@@ -69,6 +69,8 @@ class ApcUniversalClassLoader extends UniversalClassLoader
*
* @param string $prefix A prefix to create a namespace in APC
*
* @throws \RuntimeException
*
* @api
*/
public function __construct($prefix)
......
......@@ -75,6 +75,8 @@ public function unregister()
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
*
* @throws \RuntimeException
*/
public function loadClass($class)
{
......
Copyright (c) 2004-2012 Fabien Potencier
Copyright (c) 2004-2013 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
......@@ -242,7 +242,7 @@ public function register($prepend = false)
* Loads the given class or interface.
*
* @param string $class The name of the class
*
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)
......
......@@ -51,6 +51,9 @@ class XcacheClassLoader
* @param string $prefix A prefix to create a namespace in Xcache
* @param object $classFinder An object that implements findFile() method.
*
* @throws \RuntimeException
* @throws \InvalidArgumentException
*
* @api
*/
public function __construct($prefix, $classFinder)
......
CHANGELOG
=========
2.2.0
-----
* added an Extension base class with sensible defaults to be used in conjunction
with the Config component.
* added PrependExtensionInterface (to be able to allow extensions to prepend
application configuration settings for any Bundle)
2.1.0
-----
......@@ -12,4 +20,3 @@ CHANGELOG
(this includes dumped containers)
* [BC BREAK] fixed unescaping of class arguments, method
ParameterBag::unescapeValue() was made public
......@@ -29,6 +29,12 @@ public function process(ContainerBuilder $container)
$definitions = $container->getDefinitions();
$aliases = $container->getAliases();
foreach ($container->getExtensions() as $extension) {
if ($extension instanceof PrependExtensionInterface) {
$extension->prepend($container);
}
}
foreach ($container->getExtensions() as $name => $extension) {
if (!$config = $container->getExtensionConfig($name)) {
// this extension was not called
......@@ -37,6 +43,7 @@ public function process(ContainerBuilder $container)
$config = $container->getParameterBag()->resolveValue($config);
$tmpContainer = new ContainerBuilder($container->getParameterBag());
$tmpContainer->setResourceTracking($container->isTrackingResources());
$tmpContainer->addObjectResource($extension);
$extension->load($config, $tmpContainer);
......
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
interface PrependExtensionInterface
{
/**
* Allow an extension to prepend the extension configurations.
*
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container);
}
......@@ -74,7 +74,7 @@ public function process(ContainerBuilder $container)
*
* @return array
*
* @throws \RuntimeException When the config is invalid
* @throws RuntimeException When the config is invalid
*/
private function processArguments(array $arguments, $inMethodCall = false)
{
......
......@@ -26,7 +26,7 @@ class ResolveParameterPlaceHoldersPass implements CompilerPassInterface
*
* @param ContainerBuilder $container
*
* @throws ParameterNotFoundException When an invalid parameter is referenced
* @throws ParameterNotFoundException
*/
public function process(ContainerBuilder $container)
{
......
......@@ -184,8 +184,8 @@ public function setParameter($name, $value)
* @param object $service The service instance
* @param string $scope The scope of the service
*
* @throws \RuntimeException When trying to set a service in an inactive scope
* @throws \InvalidArgumentException When trying to set a service in the prototype scope
* @throws RuntimeException When trying to set a service in an inactive scope
* @throws InvalidArgumentException When trying to set a service in the prototype scope
*
* @api
*/
......@@ -401,7 +401,7 @@ public function leaveScope($name)
*
* @param ScopeInterface $scope
*
* @throws \InvalidArgumentException When the scope is invalid
* @throws InvalidArgumentException
*
* @api
*/
......
......@@ -63,6 +63,31 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*/
private $compiler;
private $trackResources = true;
/**
* Sets the track resources flag.
*
* If you are not using the loaders and therefore don't want
* to depend on the Config component, set this flag to false.
*
* @param Boolean $track true if you want to track resources, false otherwise
*/
public function setResourceTracking($track)
{
$this->trackResources = (Boolean) $track;
}
/**
* Checks if resources are tracked.
*
* @return Boolean true if resources are tracked, false otherwise
*/
public function isTrackingResources()
{
return $this->trackResources;
}
/**
* Registers an extension.
*
......@@ -86,7 +111,7 @@ public function registerExtension(ExtensionInterface $extension)
*
* @return ExtensionInterface An extension instance
*
* @throws \LogicException if the extension is not registered
* @throws LogicException if the extension is not registered
*
* @api
*/
......@@ -152,6 +177,10 @@ public function getResources()
*/
public function addResource(ResourceInterface $resource)
{
if (!$this->trackResources) {
return $this;
}
$this->resources[] = $resource;
return $this;
......@@ -159,15 +188,19 @@ public function addResource(ResourceInterface $resource)
/**
* Sets the resources for this configuration.
*
*
* @param ResourceInterface[] $resources An array of resources
*
*
* @return ContainerBuilder The current instance
*
*
* @api
*/
public function setResources(array $resources)
{
if (!$this->trackResources) {
return $this;
}
$this->resources = $resources;
return $this;
......@@ -184,6 +217,10 @@ public function setResources(array $resources)
*/
public function addObjectResource($object)
{
if (!$this->trackResources) {
return $this;
}
$parent = new \ReflectionObject($object);
do {
$this->addResource(new FileResource($parent->getFileName()));
......@@ -311,7 +348,10 @@ public function getScopeChildren()
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
{
if ($this->isFrozen()) {
throw new BadMethodCallException('Setting service on a frozen container is not allowed');
// setting a synthetic service on a frozen container is alright
if (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic()) {
throw new BadMethodCallException('Setting service on a frozen container is not allowed');
}
}
$id = strtolower($id);
......@@ -434,8 +474,10 @@ public function merge(ContainerBuilder $container)
$this->addAliases($container->getAliases());
$this->getParameterBag()->add($container->getParameterBag()->all());
foreach ($container->getResources() as $resource) {
$this->addResource($resource);
if ($this->trackResources) {
foreach ($container->getResources() as $resource) {
$this->addResource($resource);
}
}
foreach ($this->extensions as $name => $extension) {
......@@ -465,6 +507,21 @@ public function getExtensionConfig($name)
return $this->extensionConfigs[$name];
}
/**
* Prepends a config array to the configs of the given extension.
*
* @param string $name The name of the extension
* @param array $config The config to set
*/
public function prependExtensionConfig($name, array $config)
{
if (!isset($this->extensionConfigs[$name])) {
$this->extensionConfigs[$name] = array();
}
array_unshift($this->extensionConfigs[$name], $config);
}
/**
* Compiles the container.
*
......@@ -487,8 +544,10 @@ public function compile()
$this->compiler = new Compiler();
}
foreach ($this->compiler->getPassConfig()->getPasses() as $pass) {
$this->addObjectResource($pass);
if ($this->trackResources) {
foreach ($this->compiler->getPassConfig()->getPasses() as $pass) {
$this->addObjectResource($pass);
}
}
$this->compiler->compile($this);
......@@ -541,8 +600,8 @@ public function setAliases(array $aliases)
* @param string $alias The alias to create
* @param string|Alias $id The service to alias
*
* @throws \InvalidArgumentException if the id is not a string or an Alias
* @throws \InvalidArgumentException if the alias is for itself
* @throws InvalidArgumentException if the id is not a string or an Alias
* @throws InvalidArgumentException if the alias is for itself
*
* @api
*/
......
......@@ -241,7 +241,7 @@ public function addArgument($argument)
*
* @return Definition The current instance
*
* @throws \OutOfBoundsException When the replaced argument does not exist
* @throws OutOfBoundsException When the replaced argument does not exist
*
* @api
*/
......@@ -275,7 +275,7 @@ public function getArguments()
*
* @return mixed The argument value
*
* @throws \OutOfBoundsException When the argument does not exist
* @throws OutOfBoundsException When the argument does not exist
*
* @api
*/
......
......@@ -159,7 +159,7 @@ public function setPublic($boolean)
*
* @return mixed The argument value
*
* @throws \OutOfBoundsException When the argument does not exist
* @throws OutOfBoundsException When the argument does not exist
*
* @api
*/
......
......@@ -187,7 +187,7 @@ private function addServiceInclude($id, $definition)
*
* @return string
*
* @throws \RuntimeException When the factory definition is incomplete
* @throws RuntimeException When the factory definition is incomplete
* @throws ServiceCircularReferenceException When a circular reference is detected
*/
private function addServiceInlinedDefinitions($id, $definition)
......@@ -816,6 +816,8 @@ protected function getDefaultParameters()
* @param integer $indent
*
* @return string
*
* @throws InvalidArgumentException
*/
private function exportParameters($parameters, $path = '', $indent = 12)
{
......@@ -987,6 +989,8 @@ private function hasReference($id, array $arguments)
* @param Boolean $interpolate
*
* @return string
*
* @throws RuntimeException
*/
private function dumpValue($value, $interpolate = true)
{
......
......@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* ConfigurationExtensionInterface is the interface implemented by container extension classes.
......
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* Provides useful features shared by many extensions.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface
{
/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
*/
public function getXsdValidationBasePath()
{
return false;
}
/**
* Returns the namespace to be used for this extension (XML namespace).