Skip to content
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
21 changes: 21 additions & 0 deletions controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,27 @@ in your controllers.

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

Generating Controllers
----------------------

To save time, you can also tell Symfony to generate a new controller class:

.. code-block:: terminal

$ php bin/console make:controller BrandNewController

created: src/Controller/BrandNewController.php

If you want to generate an entire CRUD from a Doctrine :doc:`entity </doctrine>`,
use:

.. code-block:: terminal

$ php bin/console make:crud Product

.. versionadded::
The ``make:crud`` command was introduced in MakerBundle 1.2.

.. index::
single: Controller; Managing errors
single: Controller; 404 pages
Expand Down
8 changes: 8 additions & 0 deletions page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ You can now add your route directly *above* the controller:
That's it! The page - ``http://localhost:8000/lucky/number`` will work exactly
like before! Annotations are the recommended way to configure routes.

.. tip::

To create controllers faster, let Symfony generate it for you:

.. code-block:: terminal

$ php bin/console make:controller

.. _flex-quick-intro:

Auto-Installing Recipes with Symfony Flex
Expand Down