re-organized the sub-request management a bit (WIP)
This commit is contained in:
parent
fd331bac18
commit
72947d8588
@ -161,7 +161,7 @@ abstract class Kernel implements HttpKernelInterface, \Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a request to convert it to a response by calling the Request Handler service.
|
* Handles a request to convert it to a response by calling the HttpKernel service.
|
||||||
*
|
*
|
||||||
* @param Request $request A Request instance
|
* @param Request $request A Request instance
|
||||||
* @param Boolean $main Whether this is the main request or not
|
* @param Boolean $main Whether this is the main request or not
|
||||||
@ -177,15 +177,19 @@ abstract class Kernel implements HttpKernelInterface, \Serializable
|
|||||||
|
|
||||||
if (null === $request) {
|
if (null === $request) {
|
||||||
$request = $this->container->getRequestService();
|
$request = $this->container->getRequestService();
|
||||||
} else {
|
|
||||||
$this->container->setService('request', $request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true === $main) {
|
if (true === $main) {
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->container->getHttpKernelService()->handle($request, $main, $raw);
|
$this->container->setService('request', $request);
|
||||||
|
|
||||||
|
$response = $this->container->getHttpKernelService()->handle($request, $main, $raw);
|
||||||
|
|
||||||
|
$this->container->setService('request', $this->request);
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBundleDirs()
|
public function getBundleDirs()
|
||||||
|
@ -82,9 +82,9 @@ class Controller
|
|||||||
return $this->container->getRouterService()->generate($route, $parameters);
|
return $this->container->getRouterService()->generate($route, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function forward($controller, array $parameters = array())
|
public function forward($controller, array $path = array(), array $query = array())
|
||||||
{
|
{
|
||||||
return $this->container->getControllerLoaderService()->run($controller, $parameters);
|
return $this->container->getControllerLoaderService()->run($controller, $path, $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,17 +41,11 @@ class ControllerLoader
|
|||||||
|
|
||||||
public function run($controller, array $path = array(), array $query = array())
|
public function run($controller, array $path = array(), array $query = array())
|
||||||
{
|
{
|
||||||
$request = $this->container->getRequestService();
|
|
||||||
|
|
||||||
$path['_controller'] = $controller;
|
$path['_controller'] = $controller;
|
||||||
|
|
||||||
$subRequest = $request->duplicate($query, null, $path);
|
$subRequest = $this->container->getRequestService()->duplicate($query, null, $path);
|
||||||
|
|
||||||
$response = $this->container->getKernelService()->handle($subRequest, false, true);
|
return $this->container->getKernelService()->handle($subRequest, false, true);
|
||||||
|
|
||||||
$this->container->setService('request', $request);
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resolve(Event $event)
|
public function resolve(Event $event)
|
||||||
|
Reference in New Issue
Block a user