Commit 2ffd9d14 authored by Fabien Potencier's avatar Fabien Potencier

updated for the latest version of Symfony2

parent b8d9535d
...@@ -23,10 +23,10 @@ $framework = new Framework(array( ...@@ -23,10 +23,10 @@ $framework = new Framework(array(
// Simulate a hello request without a Client // Simulate a hello request without a Client
//$request = Request::create('/hello/Fabien'); //$request = Request::create('/hello/Fabien');
//$framework->handle($request)->send(); //$framework->run($request);
// Simulate a goodbye request without a Client // Simulate a goodbye request without a Client
//$request = Request::create('/goodbye/Fabien', 'post'); //$request = Request::create('/goodbye/Fabien', 'post');
//$framework->handle($request)->send(); //$framework->run($request);
$framework->handle()->send(); $framework->run();
No preview for this file type
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
namespace Silex; namespace Silex;
use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\BaseHttpKernel;
use Symfony\Component\HttpKernel\Controller\ControllerResolver; use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
...@@ -24,7 +25,7 @@ use Symfony\Component\Routing\Matcher\UrlMatcher; ...@@ -24,7 +25,7 @@ use Symfony\Component\Routing\Matcher\UrlMatcher;
* *
* @author Fabien Potencier <fabien.potencier@symfony-project.org> * @author Fabien Potencier <fabien.potencier@symfony-project.org>
*/ */
class Framework extends HttpKernel class Framework extends BaseHttpKernel
{ {
protected $routes; protected $routes;
...@@ -49,9 +50,18 @@ class Framework extends HttpKernel ...@@ -49,9 +50,18 @@ class Framework extends HttpKernel
parent::__construct($dispatcher, $resolver); parent::__construct($dispatcher, $resolver);
} }
public function run(Request $request = null)
{
if (null === $request) {
$request = new Request();
}
$this->handle($request)->send();
}
public function parseRequest(Event $event) public function parseRequest(Event $event)
{ {
$request = $event['request']; $request = $event->getParameter('request');
$matcher = new UrlMatcher($this->routes, array( $matcher = new UrlMatcher($this->routes, array(
'base_url' => $request->getBaseUrl(), 'base_url' => $request->getBaseUrl(),
......
Subproject commit aaba52d92816bdc9ce27b491dc8d28c2587c2c2c Subproject commit 30ccd0b794d9ff4a2e2c3d7b63a94c6dcf7b1faa
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment