File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,28 @@ in your controllers.
290
290
291
291
For more information about services, see the :doc: `/service_container ` article.
292
292
293
+ Generating Controllers
294
+ ----------------------
295
+
296
+ To save time, you can also tell Symfony to generate a new controller class:
297
+
298
+ .. code-block :: terminal
299
+
300
+ $ php bin/console make:controller BrandNewController
301
+
302
+ created: src/Controller/BrandNewController.php
303
+
304
+ If you want to generate an entire CRUD from a Doctrine :doc: `entity </doctrine >`,
305
+ use:
306
+
307
+ .. code-block :: terminal
308
+
309
+ $ php bin/console make:crud Product
310
+
311
+ .. versionadded ::
312
+
313
+ The ``make:crud `` command was added in MakerBundle 1.2.
314
+
293
315
.. index ::
294
316
single: Controller; Managing errors
295
317
single: Controller; 404 pages
Original file line number Diff line number Diff line change @@ -125,6 +125,14 @@ You can now add your route directly *above* the controller:
125
125
That's it! The page - ``http://localhost:8000/lucky/number `` will work exactly
126
126
like before! Annotations are the recommended way to configure routes.
127
127
128
+ .. tip ::
129
+
130
+ To create controllers faster, let Symfony generate it for you:
131
+
132
+ .. code-block :: terminal
133
+
134
+ $ php bin/console make:controller
135
+
128
136
.. _flex-quick-intro :
129
137
130
138
Auto-Installing Recipes with Symfony Flex
You can’t perform that action at this time.
0 commit comments