Skip to content

Commit f58745a

Browse files
authored
Merge pull request #6191 from kenjis/fix-docs-cli_generators.rst
docs: improve cli_generators.rst
2 parents 053d669 + 027bf9f commit f58745a

2 files changed

Lines changed: 27 additions & 20 deletions

File tree

user_guide_src/source/cli/cli_generators.rst

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ To view the full description and usage information on a particular generator, us
2020

2121
where ``<generator_command>`` will be replaced with the command to check.
2222

23+
.. note:: Do you need to have the generated code in a subfolder? Let's say if you want to create a controller
24+
class to reside in the ``Admin`` subfolder of the main ``Controllers`` folder, you will just need
25+
to prepend the subfolder to the class name, like this: ``php spark make:controller admin/login``. This
26+
command will create the ``Login`` controller in the ``Controllers/Admin`` subfolder with
27+
a namespace of ``App\Controllers\Admin``.
28+
29+
.. note:: Working on modules? Code generation will set the root namespace to a default of ``APP_NAMESPACE``.
30+
Should you need to have the generated code elsewhere in your module namespace, make sure to set
31+
the ``--namespace`` option in your command, e.g., ``php spark make:model blog --namespace Acme\Blog``.
32+
33+
.. warning:: Make sure when setting the ``--namespace`` option that the supplied namespace is a valid
34+
namespace defined in your ``$psr4`` array in ``Config\Autoload`` or defined in your composer autoload
35+
file. Otherwise, code generation will be interrupted.
36+
37+
.. warning:: Use of ``migrate:create`` to create migration files is now deprecated. It will be removed in
38+
future releases. Please use ``make:migration`` as replacement. Also, please use ``make:migration --session``
39+
to use instead of the deprecated ``session:migration``.
40+
2341
*******************
2442
Built-in Generators
2543
*******************
@@ -94,6 +112,13 @@ Options:
94112
* ``--suffix``: Append the component suffix to the generated class name.
95113
* ``--force``: Set this flag to overwrite existing files on destination.
96114

115+
.. note:: If you use ``--suffix``, the generated controller name will be like
116+
``ProductController``. That violates the Controller naming convention
117+
when using :ref:`Auto Routing <controller-auto-routing-improved>`
118+
(Controller class names MUST start with an uppercase letter and
119+
ONLY the first character can be uppercase). So ``--suffix`` can be used
120+
when you use :ref:`Defined Routes <defined-route-routing>`.
121+
97122
make:entity
98123
-----------
99124

@@ -226,24 +251,6 @@ Options:
226251
* ``--suffix``: Append the component suffix to the generated class name.
227252
* ``--force``: Set this flag to overwrite existing files on destination.
228253

229-
.. note:: Do you need to have the generated code in a subfolder? Let's say if you want to create a controller
230-
class to reside in the ``Admin`` subfolder of the main ``Controllers`` folder, you will just need
231-
to prepend the subfolder to the class name, like this: ``php spark make:controller admin/login``. This
232-
command will create the ``Login`` controller in the ``Controllers/Admin`` subfolder with
233-
a namespace of ``App\Controllers\Admin``.
234-
235-
.. note:: Working on modules? Code generation will set the root namespace to a default of ``APP_NAMESPACE``.
236-
Should you need to have the generated code elsewhere in your module namespace, make sure to set
237-
the ``--namespace`` option in your command, e.g., ``php spark make:model blog --namespace Acme\Blog``.
238-
239-
.. warning:: Make sure when setting the ``--namespace`` option that the supplied namespace is a valid
240-
namespace defined in your ``$psr4`` array in ``Config\Autoload`` or defined in your composer autoload
241-
file. Otherwise, code generation will be interrupted.
242-
243-
.. warning:: Use of ``migrate:create`` to create migration files is now deprecated. It will be removed in
244-
future releases. Please use ``make:migration`` as replacement. Also, please use ``make:migration --session``
245-
to use instead of the deprecated ``session:migration``.
246-
247254
****************************************
248255
Scaffolding a Complete Set of Stock Code
249256
****************************************

user_guide_src/source/incoming/controllers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ controllers. You can extend this class in any new controller.
144144

145145
Then save the file to your **app/Controllers/** directory.
146146

147-
.. important:: The file must be called **Helloworld.php**, with a capital ``H``. Controller class names MUST start with an uppercase letter and ONLY the first character can be uppercase.
147+
.. important:: The file must be called **Helloworld.php**, with a capital ``H``. When you use Auto Routing, Controller class names MUST start with an uppercase letter and ONLY the first character can be uppercase.
148148

149149
.. important:: A controller method that will be executed by Auto Routing (Improved) needs HTTP verb (``get``, ``post``, ``put``, etc.) prefix like ``getIndex()``, ``postCreate()``.
150150

@@ -315,7 +315,7 @@ For security reasons be sure to declare any new utility methods as ``protected``
315315

316316
Then save the file to your **app/Controllers/** directory.
317317

318-
.. important:: The file must be called **Helloworld.php**, with a capital ``H``. Controller class names MUST start with an uppercase letter and ONLY the first character can be uppercase.
318+
.. important:: The file must be called **Helloworld.php**, with a capital ``H``. When you use Auto Routing, Controller class names MUST start with an uppercase letter and ONLY the first character can be uppercase.
319319

320320
Now visit your site using a URL similar to this::
321321

0 commit comments

Comments
 (0)