Skip to content

Fixed the Quick Tour sample code to work just by copy and paste. #13981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions quick_tour/flex_recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Thanks to Flex, after one command, you can start using Twig immediately:

.. code-block:: diff

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand Down Expand Up @@ -153,6 +154,7 @@ Rich API Support

Are you building an API? You can already return JSON from any controller::

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand Down Expand Up @@ -189,6 +191,7 @@ But like usual, we can immediately start using the new library. Want to create a
rich API for a ``product`` table? Create a ``Product`` entity and give it the
``@ApiResource()`` annotation::

<?php
// src/Entity/Product.php
namespace App\Entity;

Expand Down
5 changes: 5 additions & 0 deletions quick_tour/the_architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Want a logging system? No problem:
This installs and configures (via a recipe) the powerful `Monolog`_ library. To
use the logger in a controller, add a new argument type-hinted with ``LoggerInterface``::

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand Down Expand Up @@ -89,6 +90,7 @@ To keep your code organized, you can even create your own services! Suppose you
want to generate a random greeting (e.g. "Hello", "Yo", etc). Instead of putting
this code directly in your controller, create a new class::

<?php
// src/GreetingGenerator.php
namespace App;

Expand All @@ -105,6 +107,7 @@ this code directly in your controller, create a new class::

Great! You can use this immediately in your controller::

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand Down Expand Up @@ -135,6 +138,7 @@ difference is that it's done in the constructor:

.. code-block:: diff

<?php
// src/GreetingGenerator.php
+ use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -167,6 +171,7 @@ by creating an event subscriber or a security voter for complex authorization
rules. Let's add a new filter to Twig called ``greet``. How? Create a class
that extends ``AbstractExtension``::

<?php
// src/Twig/GreetExtension.php
namespace App\Twig;

Expand Down
4 changes: 4 additions & 0 deletions quick_tour/the_big_picture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ doesn't exist yet, so let's create it!
In ``src/Controller``, create a new ``DefaultController`` class and an ``index``
method inside::

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand Down Expand Up @@ -115,6 +116,7 @@ like a wildcard that matches anything. And it gets better! Update the controller

.. code-block:: diff

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand Down Expand Up @@ -153,6 +155,7 @@ Instead, add the route *right above* the controller method:

.. code-block:: diff

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand All @@ -173,6 +176,7 @@ This works just like before! But by using annotations, the route and controller
live right next to each other. Need another page? Add another route and method
in ``DefaultController``::

<?php
// src/Controller/DefaultController.php
namespace App\Controller;

Expand Down