Commit 99ddee03 authored by Fabien Potencier's avatar Fabien Potencier

Merge branch '1.0'

* 1.0:
  bumped version to 1.0.2-DEV
  prepared the 1.0.1 release
  updated CHANGELOG for 1.0
  added a unit test for previous merge (refs #706)
  Fixed typo in the ServiceProviderInterface interface PHPDoc block.
  Add note on how to handle fatal errors, as per mailing list
  Alter app references in middleware doc
  Make DoctrineServiceProvider db connection lazy
  Workaround for OptionsResolver validating options
  add '_route' key to RedirectableUrlMatcher::redirect
  reflect change: Modularity chapter renamed to Organizing Controllers (#570)
  Add target branch notes
  Fixed namespace path

Conflicts:
	doc/changelog.rst
	src/Silex/Application.php
	tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php
parents ad96cb09 9717cc0c
...@@ -10,6 +10,12 @@ Changelog ...@@ -10,6 +10,12 @@ Changelog
lazy, so that they will not instantiate the dispatcher early. lazy, so that they will not instantiate the dispatcher early.
* Dropped support for 2.1 and 2.2 versions of symfony. * Dropped support for 2.1 and 2.2 versions of symfony.
1.0.1 (2013-07-04)
------------------
* Fixed RedirectableUrlMatcher::redirect() when Silex is configured to use a logger
* Make ``DoctrineServiceProvider`` multi-db support lazy.
1.0.0 (2013-05-03) 1.0.0 (2013-05-03)
------------------ ------------------
......
...@@ -14,7 +14,7 @@ steps. ...@@ -14,7 +14,7 @@ steps.
* Optionally, add some technical documentation. * Optionally, add some technical documentation.
* Send a pull request. Bonus points for topic branches. * Send a pull request, to the correct `target branch`_. Bonus points for topic branches.
If you have a big change or would like to discuss something, If you have a big change or would like to discuss something,
please join us on the `mailing list please join us on the `mailing list
...@@ -25,6 +25,22 @@ please join us on the `mailing list ...@@ -25,6 +25,22 @@ please join us on the `mailing list
Any code you contribute must be licensed under the MIT Any code you contribute must be licensed under the MIT
License. License.
Target branch
=============
Before you create a pull request for Silex, you need to determine which branch
to submit it to. Read this section carefully first.
Silex has two active branches: `1.0` and `master` (`1.1`).
* **1.0**: Bugfixes and documentation fixes go into the 1.0 branch. 1.0 is
periodically merged into master. The 1.0 branch targets versions 2.1, 2.2 and
2.3 of Symfony2.
* **1.1**: All new features go into the 1.1 branch. Changes cannot break
backward compatibility. The 1.1 branch targets the 2.3 version of Symfony2.
Writing Documentation Writing Documentation
===================== =====================
......
...@@ -29,8 +29,19 @@ You register it by calling the static ``register`` method:: ...@@ -29,8 +29,19 @@ You register it by calling the static ``register`` method::
It is recommended that you do this in your front controller, i.e. It is recommended that you do this in your front controller, i.e.
``web/index.php``. ``web/index.php``.
.. note:: Handling fatal errors
---------------------
The ``ErrorHandler`` has nothing to do with the ``ExceptionHandler``. The To handle fatal errors, you can additionally register a global
``ExceptionHandler`` is responsible for displaying caught exceptions ``ExceptionHandler``::
nicely.
use Symfony\Component\HttpKernel\Debug\ExceptionHandler;
ExceptionHandler::register();
In production you may want to disable the debug output by passing ``false`` as
the ``$debug`` argument::
use Symfony\Component\HttpKernel\Debug\ExceptionHandler;
ExceptionHandler::register(false);
...@@ -95,7 +95,7 @@ Before Middleware ...@@ -95,7 +95,7 @@ Before Middleware
A *before* route middleware is fired just before the route callback, but after A *before* route middleware is fired just before the route callback, but after
the *before* application middlewares:: the *before* application middlewares::
$before = function (Request $request) use ($app) { $before = function (Request $request, Application $app) {
// ... // ...
}; };
...@@ -110,7 +110,7 @@ After Middleware ...@@ -110,7 +110,7 @@ After Middleware
An *after* route middleware is fired just after the route callback, but before An *after* route middleware is fired just after the route callback, but before
the application *after* application middlewares:: the application *after* application middlewares::
$after = function (Request $request, Response $response) use ($app) { $after = function (Request $request, Response $response, Application $app) {
// ... // ...
}; };
......
...@@ -30,7 +30,7 @@ it can be used for functional tests too. You write tests by creating a new ...@@ -30,7 +30,7 @@ it can be used for functional tests too. You write tests by creating a new
class, that extends the ``PHPUnit_Framework_TestCase``. Your test cases are class, that extends the ``PHPUnit_Framework_TestCase``. Your test cases are
methods prefixed with ``test``:: methods prefixed with ``test``::
class ContactFormTest extends PHPUnit_Framework_TestCase class ContactFormTest extends \PHPUnit_Framework_TestCase
{ {
public function testInitialPage() public function testInitialPage()
{ {
......
...@@ -462,8 +462,8 @@ the defaults for new controllers. ...@@ -462,8 +462,8 @@ the defaults for new controllers.
.. note:: .. note::
The global configuration does not apply to controller providers you might The global configuration does not apply to controller providers you might
mount as they have their own global configuration (see the Modularity mount as they have their own global configuration (read the
paragraph below). :doc:`dedicated chapter<organizing_controllers>` for more information).
Error handlers Error handlers
-------------- --------------
......
...@@ -74,7 +74,9 @@ class DoctrineServiceProvider implements ServiceProviderInterface ...@@ -74,7 +74,9 @@ class DoctrineServiceProvider implements ServiceProviderInterface
$manager = $app['dbs.event_manager'][$name]; $manager = $app['dbs.event_manager'][$name];
} }
$dbs[$name] = DriverManager::getConnection($options, $config, $manager); $dbs[$name] = $dbs->share(function ($dbs) use ($options, $config, $manager) {
return DriverManager::getConnection($options, $config, $manager);
});
} }
return $dbs; return $dbs;
......
...@@ -49,6 +49,7 @@ class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher ...@@ -49,6 +49,7 @@ class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher
return array( return array(
'_controller' => function ($url) { return new RedirectResponse($url, 301); }, '_controller' => function ($url) { return new RedirectResponse($url, 301); },
'_route' => null,
'url' => $url, 'url' => $url,
); );
} }
......
...@@ -31,7 +31,7 @@ interface ServiceProviderInterface ...@@ -31,7 +31,7 @@ interface ServiceProviderInterface
/** /**
* Bootstraps the application. * Bootstraps the application.
* *
* This method is called after all services are registers * This method is called after all services are registered
* and should be used for "dynamic" configuration (whenever * and should be used for "dynamic" configuration (whenever
* a service must be requested). * a service must be requested).
*/ */
......
...@@ -14,9 +14,11 @@ namespace Silex\Tests; ...@@ -14,9 +14,11 @@ namespace Silex\Tests;
use Silex\Application; use Silex\Application;
use Silex\ControllerCollection; use Silex\ControllerCollection;
use Silex\Route; use Silex\Route;
use Silex\Provider\MonologServiceProvider;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\StreamedResponse;
...@@ -500,6 +502,19 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase ...@@ -500,6 +502,19 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertFalse(class_exists('Symfony\Component\HttpFoundation\BinaryFileResponse')); $this->assertFalse(class_exists('Symfony\Component\HttpFoundation\BinaryFileResponse'));
} }
} }
public function testRedirectDoesNotRaisePHPNoticesWhenMonologIsRegistered()
{
$app = new Application();
ErrorHandler::register();
$app['monolog.logfile'] = 'php://memory';
$app->register(new MonologServiceProvider());
$app->get('/foo/', function() { return 'ok'; });
$response = $app->handle(Request::create('/foo'));
$this->assertEquals(301, $response->getStatusCode());
}
} }
class FooController class FooController
......
...@@ -87,8 +87,8 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -87,8 +87,8 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase
)); ));
$builder = $app['form.factory']->createBuilder('form', array(), array( $builder = $app['form.factory']->createBuilder('form', array(), array(
'constraints' => $constraints, 'constraints' => $constraints,
'csrf_protection' => false, 'csrf_protection' => false,
)); ));
$form = $builder $form = $builder
......
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