Skip to content

Commit fd5bd74

Browse files
committed
Documenting make:controller and make:crud
1 parent 7a740fe commit fd5bd74

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

controller.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,28 @@ in your controllers.
290290

291291
For more information about services, see the :doc:`/service_container` article.
292292

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+
293315
.. index::
294316
single: Controller; Managing errors
295317
single: Controller; 404 pages

page_creation.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ You can now add your route directly *above* the controller:
125125
That's it! The page - ``http://localhost:8000/lucky/number`` will work exactly
126126
like before! Annotations are the recommended way to configure routes.
127127

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+
128136
.. _flex-quick-intro:
129137

130138
Auto-Installing Recipes with Symfony Flex

0 commit comments

Comments
 (0)