Commit 67639888 authored by Fabien Potencier's avatar Fabien Potencier

Merge branch '1.0' into 1.1

* 1.0:
  Fix typos
parents 33da608a 185be1eb
......@@ -32,8 +32,8 @@ By calling ``handle``, you can make a sub-request manually. Here's an example::
$response = $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false);
There's some more things that you need to keep in mind though. In most cases
you will want to forward some parts of the current master request to the sub-
request. That includes: Cookies, server information, session.
you will want to forward some parts of the current master request to the
sub-request. That includes: Cookies, server information, session.
Here is a more advanced example that forwards said information (``$request``
holds the master request)::
......
......@@ -127,8 +127,7 @@ example::
return $app['twig']->render('index.twig', array('form' => $form->createView()));
});
And here is the ``index.twig`` form template (requires ``symfony/twig-
bridge``):
And here is the ``index.twig`` form template (requires ``symfony/twig-bridge``):
.. code-block:: jinja
......
......@@ -13,7 +13,7 @@ Parameters
* **monolog.logfile**: File where logs are written to.
* **monolog.level** (optional): Level of logging defaults
* **monolog.level** (optional): Level of logging, defaults
to ``DEBUG``. Must be one of ``Logger::DEBUG``, ``Logger::INFO``,
``Logger::WARNING``, ``Logger::ERROR``. ``DEBUG`` will log
everything, ``INFO`` will log everything except ``DEBUG``,
......
......@@ -41,22 +41,22 @@ The ``SerializerServiceProvider`` provider provides a ``serializer`` service:
use Silex\Application;
use Silex\Provider\SerializerServiceProvider;
use Symfony\Component\HttpFoundation\Response;
$app = new Application();
$app->register(new SerializerServiceProvider());
// only accept content types supported by the serializer via the assert method.
$app->get("/pages/{id}.{_format}", function ($id) use ($app) {
// assume a page_repository service exists that returns Page objects. The
// object returned has getters and setters exposing the state.
$page = $app['page_repository']->find($id);
$format = $app['request']->getRequestFormat();
if (!$page instanceof Page) {
$app->abort("No page found for id: $id");
}
return new Response($app['serializer']->serialize($page, $format), 200, array(
"Content-Type" => $app['request']->getMimeType($format)
));
......
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