Skip to content

Commit 8f3ff01

Browse files
okazyjaviereguiluz
authored andcommitted
Fixed the quick tour sample code to work just by copy and paste.
1 parent ff401de commit 8f3ff01

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Diff for: quick_tour/flex_recipes.rst

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Thanks to Flex, after one command, you can start using Twig immediately:
7575

7676
.. code-block:: diff
7777
78+
<?php
7879
// src/Controller/DefaultController.php
7980
namespace App\Controller;
8081
@@ -153,6 +154,7 @@ Rich API Support
153154

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

157+
<?php
156158
// src/Controller/DefaultController.php
157159
namespace App\Controller;
158160

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

194+
<?php
192195
// src/Entity/Product.php
193196
namespace App\Entity;
194197

Diff for: quick_tour/the_architecture.rst

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Want a logging system? No problem:
2121
This installs and configures (via a recipe) the powerful `Monolog`_ library. To
2222
use the logger in a controller, add a new argument type-hinted with ``LoggerInterface``::
2323

24+
<?php
2425
// src/Controller/DefaultController.php
2526
namespace App\Controller;
2627

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

93+
<?php
9294
// src/GreetingGenerator.php
9395
namespace App;
9496

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

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

110+
<?php
108111
// src/Controller/DefaultController.php
109112
namespace App\Controller;
110113

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

136139
.. code-block:: diff
137140
141+
<?php
138142
// src/GreetingGenerator.php
139143
+ use Psr\Log\LoggerInterface;
140144
@@ -167,6 +171,7 @@ by creating an event subscriber or a security voter for complex authorization
167171
rules. Let's add a new filter to Twig called ``greet``. How? Create a class
168172
that extends ``AbstractExtension``::
169173

174+
<?php
170175
// src/Twig/GreetExtension.php
171176
namespace App\Twig;
172177

Diff for: quick_tour/the_big_picture.rst

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ doesn't exist yet, so let's create it!
8080
In ``src/Controller``, create a new ``DefaultController`` class and an ``index``
8181
method inside::
8282

83+
<?php
8384
// src/Controller/DefaultController.php
8485
namespace App\Controller;
8586

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

116117
.. code-block:: diff
117118
119+
<?php
118120
// src/Controller/DefaultController.php
119121
namespace App\Controller;
120122
@@ -153,6 +155,7 @@ Instead, add the route *right above* the controller method:
153155

154156
.. code-block:: diff
155157
158+
<?php
156159
// src/Controller/DefaultController.php
157160
namespace App\Controller;
158161
@@ -173,6 +176,7 @@ This works just like before! But by using annotations, the route and controller
173176
live right next to each other. Need another page? Add another route and method
174177
in ``DefaultController``::
175178

179+
<?php
176180
// src/Controller/DefaultController.php
177181
namespace App\Controller;
178182

0 commit comments

Comments
 (0)