|
@@ -30,6 +30,10 @@ class Container implements ContainerInterface
|
|
|
{
|
|
|
protected $parameterBag;
|
|
|
protected $services;
|
|
|
+ protected $scopes;
|
|
|
+ protected $scopeChildren;
|
|
|
+ protected $scopedServices;
|
|
|
+ protected $scopeStacks;
|
|
|
protected $loading = array();
|
|
|
public function __construct(ParameterBagInterface $parameterBag = null)
|
|
|
{
|
|
@@ -174,13 +178,9 @@ class Container implements ContainerInterface
|
|
|
}
|
|
|
$this->scopes[$name] = $parentScope;
|
|
|
$this->scopeChildren[$name] = array();
|
|
|
- if ($parentScope !== self::SCOPE_CONTAINER) {
|
|
|
+ while ($parentScope !== self::SCOPE_CONTAINER) {
|
|
|
$this->scopeChildren[$parentScope][] = $name;
|
|
|
- foreach ($this->scopeChildren as $pName => $childScopes) {
|
|
|
- if (in_array($parentScope, $childScopes, true)) {
|
|
|
- $this->scopeChildren[$pName][] = $name;
|
|
|
- }
|
|
|
- }
|
|
|
+ $parentScope = $this->scopes[$parentScope];
|
|
|
}
|
|
|
}
|
|
|
public function hasScope($name)
|
|
@@ -485,9 +485,11 @@ class HttpKernel implements HttpKernelInterface
|
|
|
throw new \LogicException(sprintf('The controller must be a callable (%s given).', $this->varToString($controller)));
|
|
|
}
|
|
|
$arguments = $this->resolver->getArguments($request, $controller);
|
|
|
- $retval = call_user_func_array($controller, $arguments);
|
|
|
- $event = new Event($this, 'core.view', array('request_type' => $type, 'request' => $request));
|
|
|
- $response = $this->dispatcher->filter($event, $retval);
|
|
|
+ $response = call_user_func_array($controller, $arguments);
|
|
|
+ if (!$response instanceof Response) {
|
|
|
+ $event = new Event($this, 'core.view', array('request_type' => $type, 'request' => $request));
|
|
|
+ $response = $this->dispatcher->filter($event, $response);
|
|
|
+ }
|
|
|
return $this->filterResponse($response, $request, sprintf('The controller must return a response (%s given).', $this->varToString($response)), $type);
|
|
|
}
|
|
|
protected function filterResponse($response, $request, $message, $type)
|
|
@@ -967,6 +969,11 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|
|
class FileBag extends ParameterBag
|
|
|
{
|
|
|
private $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type');
|
|
|
+ public function __construct(array $parameters = array())
|
|
|
+ {
|
|
|
+ parent::__construct();
|
|
|
+ $this->replace($parameters);
|
|
|
+ }
|
|
|
public function replace(array $files = array())
|
|
|
{
|
|
|
$this->parameters = array();
|