Commit 1a8a0deb authored by Fabien Potencier's avatar Fabien Potencier

bug #926 Fix #856: Revert a0644877 as it introduced a BC break (romainneutron)

This PR was merged into the 1.2.x-dev branch.

Discussion
----------

Fix #856: Revert a0644877 as it introduced a BC break

This fixes #856

Commits
-------

e9571ccc Fix #856: Revert a0644877 as it introduced a BC break
parents 5f449095 e9571ccc
...@@ -13,7 +13,7 @@ namespace Silex\EventListener; ...@@ -13,7 +13,7 @@ namespace Silex\EventListener;
use Silex\CallbackResolver; use Silex\CallbackResolver;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
...@@ -42,9 +42,9 @@ class ConverterListener implements EventSubscriberInterface ...@@ -42,9 +42,9 @@ class ConverterListener implements EventSubscriberInterface
/** /**
* Handles converters. * Handles converters.
* *
* @param GetResponseEvent $event The event to handle * @param FilterControllerEvent $event The event to handle
*/ */
public function onKernelRequest(GetResponseEvent $event) public function onKernelController(FilterControllerEvent $event)
{ {
$request = $event->getRequest(); $request = $event->getRequest();
$route = $this->routes->get($request->attributes->get('_route')); $route = $this->routes->get($request->attributes->get('_route'));
...@@ -60,7 +60,7 @@ class ConverterListener implements EventSubscriberInterface ...@@ -60,7 +60,7 @@ class ConverterListener implements EventSubscriberInterface
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return array(
KernelEvents::REQUEST => 'onKernelRequest', KernelEvents::CONTROLLER => 'onKernelController',
); );
} }
} }
...@@ -125,25 +125,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase ...@@ -125,25 +125,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('foobar', $response->getContent()); $this->assertEquals('foobar', $response->getContent());
} }
public function testConvertedAttributeIsAvailableInBeforeFilter()
{
$app = new Application();
$beforeValue = null;
$app
->get('/foo/{foo}', function ($foo) {
return $foo;
})
->convert('foo', function ($foo) { return $foo.'converted'; })
->before(function (Request $request) use (&$beforeValue) {
$beforeValue = $request->attributes->get('foo');
});
$response = $app->handle(Request::create('/foo/bar'));
$this->assertEquals('barconverted', $beforeValue);
$this->assertEquals('barconverted', $response->getContent());
}
public function testOn() public function testOn()
{ {
$app = new Application(); $app = new Application();
......
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