Commit 8ca1ee04 authored by Fabien Potencier's avatar Fabien Potencier

updated vendors

parent 81afa6bd
......@@ -20,7 +20,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Events as HttpKernelEvents;
use Symfony\Component\HttpKernel\CoreEvents;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\EventDispatcher\Event;
......@@ -69,7 +69,6 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
$this['dispatcher'] = $this->share(function () use ($app) {
$dispatcher = new EventDispatcher();
$dispatcher->addSubscriber($app);
$dispatcher->addListener(HttpKernelEvents::onCoreView, $app, -10);
return $dispatcher;
});
......@@ -189,7 +188,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
*/
public function before($callback)
{
$this['dispatcher']->addListener(Events::onSilexBefore, $callback);
$this['dispatcher']->addListener(SilexEvents::BEFORE, $callback);
}
/**
......@@ -201,7 +200,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
*/
public function after($callback)
{
$this['dispatcher']->addListener(Events::onSilexAfter, $callback);
$this['dispatcher']->addListener(SilexEvents::AFTER, $callback);
}
/**
......@@ -221,7 +220,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
*/
public function error($callback)
{
$this['dispatcher']->addListener(Events::onSilexError, function (GetResponseForErrorEvent $event) use ($callback) {
$this['dispatcher']->addListener(SilexEvents::ERROR, function (GetResponseForErrorEvent $event) use ($callback) {
$exception = $event->getException();
$result = $callback($exception);
......@@ -337,7 +336,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
} catch (RoutingException $e) {
// make sure onSilexBefore event is dispatched
$this['dispatcher']->dispatch(Events::onSilexBefore);
$this['dispatcher']->dispatch(SilexEvents::BEFORE);
if ($e instanceof ResourceNotFoundException) {
$message = sprintf('No route found for "%s %s"', $this['request']->getMethod(), $this['request']->getPathInfo());
......@@ -350,7 +349,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
throw $e;
}
$this['dispatcher']->dispatch(Events::onSilexBefore);
$this['dispatcher']->dispatch(SilexEvents::BEFORE);
}
/**
......@@ -388,7 +387,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
*/
public function onCoreResponse(Event $event)
{
$this['dispatcher']->dispatch(Events::onSilexAfter);
$this['dispatcher']->dispatch(SilexEvents::AFTER);
}
/**
......@@ -402,7 +401,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
public function onCoreException(GetResponseForExceptionEvent $event)
{
$errorEvent = new GetResponseForErrorEvent($this, $event->getRequest(), $event->getRequestType(), $event->getException());
$this['dispatcher']->dispatch(Events::onSilexError, $errorEvent);
$this['dispatcher']->dispatch(SilexEvents::ERROR, $errorEvent);
if ($errorEvent->hasResponse()) {
$event->setResponse($errorEvent->getResponse());
......@@ -417,10 +416,11 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
// onCoreView listener is added manually because it has lower priority
return array(
HttpKernelEvents::onCoreRequest,
HttpKernelEvents::onCoreController,
HttpKernelEvents::onCoreResponse,
HttpKernelEvents::onCoreException,
CoreEvents::REQUEST => 'onCoreRequest',
CoreEvents::CONTROLLER => 'onCoreController',
CoreEvents::RESPONSE => 'onCoreResponse',
CoreEvents::EXCEPTION => 'onCoreException',
CoreEvents::VIEW => array('onCoreView', -10),
);
}
}
......@@ -13,7 +13,6 @@ namespace Silex\Extension;
use Silex\Application;
use Silex\ExtensionInterface;
use Symfony\Component\HttpFoundation\File\TemporaryStorage;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\Extension\Core\CoreExtension;
......@@ -25,11 +24,10 @@ class FormExtension implements ExtensionInterface
public function register(Application $app)
{
$app['form.secret'] = md5(__DIR__);
$app['form.tmp_dir'] = sys_get_temp_dir();
$app['form.factory'] = $app->share(function () use ($app) {
$extensions = array(
new CoreExtension($app['form.storage']),
new CoreExtension(),
new CsrfExtension($app['form.csrf_provider']),
);
......@@ -44,10 +42,6 @@ class FormExtension implements ExtensionInterface
return new DefaultCsrfProvider($app['form.secret']);
});
$app['form.storage'] = $app->share(function () use ($app) {
return new TemporaryStorage($app['form.secret'], $app['form.tmp_dir']);
});
if (isset($app['form.class_path'])) {
$app['autoloader']->registerNamespace('Symfony\\Component\\Form', $app['form.class_path']);
}
......
......@@ -16,7 +16,7 @@ use Silex\ExtensionInterface;
use Symfony\Component\HttpFoundation\SessionStorage\NativeSessionStorage;
use Symfony\Component\HttpFoundation\Session;
use Symfony\Component\HttpKernel\Events as HttpKernelEvents;
use Symfony\Component\HttpKernel\CoreEvents;
class SessionExtension implements ExtensionInterface
{
......@@ -34,7 +34,7 @@ class SessionExtension implements ExtensionInterface
return new NativeSessionStorage($app['session.storage.options']);
});
$app['dispatcher']->addListener(HttpKernelEvents::onCoreRequest, $this, -255);
$app['dispatcher']->addListener(CoreEvents::REQUEST, array($this, 'onCoreRequest'), -255);
if (!isset($app['session.storage.options'])) {
$app['session.storage.options'] = array();
......
......@@ -14,9 +14,9 @@ namespace Silex;
/**
* @author Igor Wiedler <igor@wiedler.ch>
*/
final class Events
final class SilexEvents
{
const onSilexBefore = 'onSilexBefore';
const onSilexAfter = 'onSilexAfter';
const onSilexError = 'onSilexError';
const BEFORE = 'onSilexBefore';
const AFTER = 'onSilexAfter';
const ERROR = 'onSilexError';
}
......@@ -89,11 +89,11 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$request = Request::create('/redirect');
$response = $app->handle($request);
$this->assertTrue($response->isRedirected('/target'));
$this->assertTrue($response->isRedirect('/target'));
$request = Request::create('/redirect2');
$response = $app->handle($request);
$this->assertTrue($response->isRedirected('/target2'));
$this->assertTrue($response->isRedirect('/target2'));
}
/**
......
Subproject commit a6dc07c9deaf59453a0e938af12ade5e01ed081f
Subproject commit d5060935745cbe509c39f36a34965ff67511282f
Subproject commit 86fed40f30a64d0726ed19060d4b872f2feaaf7d
Subproject commit f289917e07a7bcecb4d27c782fb9b4380136baa9
Subproject commit 4f94a314de30ebfb6d4ab7375230f51efd8547da
Subproject commit 4e6c37f450ee2aa82295e90ae8d286c44b0d3d9a
Subproject commit 2a0285242c9c53bdb0e0650d7578611e03a0ad34
Subproject commit 8bd13e894b42e2735384c99c3be962e8d2c3e5df
Subproject commit 35999b442a660774cc78df1034ae02dad8568206
Subproject commit 87fdf4537232724309306cb08edf19e69e78132f
Subproject commit 42709a7857fd46fd67fdb452302f1b0bdcd4eccb
Subproject commit 83d148b10f3acf2a1d1cc427386a1d3d1a125206
Subproject commit 3fe5b472d0c9888347caa13ff706a6076672b8d9
Subproject commit a20dc40fa90b47663017cf7f2f628ca90909985a
Subproject commit ce4f2e6b3446ac4f9d3b65ddb2391acb033bd077
Subproject commit 7442467e4bbba0c7c26960f1dc8211cc11c5298f
Subproject commit a003d069fc7b15b58538638ec963881bd6910b33
Subproject commit a6acc9ac44956f65806dccab6ca89ab1c2308e4f
Subproject commit 06a4275c5835aaa8be56bbd765a7c0d8cf6f1631
Subproject commit 66ab5135dafa42c1a41b3045a269834a243ef798
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