diff --git a/en/bake.rst b/en/bake.rst
index ddb16aa4f2..daf495959a 100644
--- a/en/bake.rst
+++ b/en/bake.rst
@@ -14,7 +14,7 @@ Installation
Before trying to use or extend bake, make sure it is installed in your
application. Bake is provided as a plugin that you can install with Composer::
- composer require --dev cakephp/bake:~1.0
+ composer require --dev cakephp/bake:~2.0
The above will install bake as a development dependency. This means that it will
not be installed when you do production deployments.
diff --git a/en/bake/development.rst b/en/bake/development.rst
index ca4fec39e1..00f121849f 100644
--- a/en/bake/development.rst
+++ b/en/bake/development.rst
@@ -8,11 +8,10 @@ view class which uses the `Twig `_ template engine.
Bake Events
===========
-As a view class, ``BakeView`` emits the same events as any other view class,
-plus one extra initialize event. However, whereas standard view classes use the
-event prefix "View.", ``BakeView`` uses the event prefix "Bake.".
+As a view class, ``BakeView`` emits the similar events to the standard view
+classes, but prefixed with ``Bake.`` instead of ``View.``.
-The initialize event can be used to make changes which apply to all baked
+The ``Bake.initialize`` event can be used to make changes which apply to all baked
output, for example to add another helper to the bake view class this event can
be used::
@@ -112,57 +111,37 @@ to modify bake template files, is to bake a class and compare the template used
with the pre-processed template file which is left in the application's
**tmp/bake** folder.
-So, for example, when baking a shell like so:
+So, for example, when baking a command like so:
.. code-block:: bash
- bin/cake bake shell Foo
+ bin/cake bake command Foo
-The template used (**vendor/cakephp/bake/templates/Bake/Shell/shell.twig**)
+The template used (**vendor/cakephp/bake/templates/Bake/Command/command.twig**)
looks like this::
Test->classSuffixes[$this->name()])) {
- $this->Test->classSuffixes[$this->name()] = 'Foo';
+ if ($args->getOption('no-test')) {
+ return;
}
+ $test = new \Bake\Command\TestCommand();
+ $test->plugin = $this->plugin;
- $name = ucfirst($this->name());
- if (!isset($this->Test->classTypes[$name])) {
- $this->Test->classTypes[$name] = 'Foo';
+ $name = $this->name();
+ if (!isset($test->classSuffixes[$name])) {
+ $test->classSuffixes[$name] = 'Foo';
+ }
+ $title = ucfirst($name);
+ if (!isset($test->classTypes[$title])) {
+ $test->classTypes[$title] = 'Foo';
}
+ $test->bake($name, $className, $args, $io);
return parent::bakeTest($className);
}
diff --git a/en/bake/usage.rst b/en/bake/usage.rst
index f844792c6d..db51edda84 100644
--- a/en/bake/usage.rst
+++ b/en/bake/usage.rst
@@ -17,107 +17,57 @@ tasks.
For windows system try with ``bin\cake bake``.
-You should see something like::
-
- $ bin/cake bake
-
- Welcome to CakePHP v3.4.6 Console
- ---------------------------------------------------------------
- App : src
- Path: /var/www/cakephp.dev/src/
- PHP : 5.6.20
- ---------------------------------------------------------------
- The following commands can be used to generate skeleton code for your application.
-
- Available bake commands:
-
- - all
- - behavior
- - cell
- - component
- - controller
- - fixture
- - form
- - helper
- - mailer
- - migration
- - migration_diff
- - migration_snapshot
- - model
- - plugin
- - seed
- - shell
- - shell_helper
- - task
- - template
- - test
-
- By using `cake bake [name]` you can invoke a specific bake task.
-
-You can get more information on what each task does, and what options are
-available using the ``--help`` option::
-
- $ bin/cake bake --help
-
- Welcome to CakePHP v3.4.6 Console
- ---------------------------------------------------------------
- App : src
- Path: /var/www/cakephp.dev/src/
- PHP : 5.6.20
- ---------------------------------------------------------------
- The Bake script generates controllers, models and template files for
- your application. If run with no command line arguments, Bake guides the
- user through the class creation process. You can customize the
- generation process by telling Bake where different parts of your
- application are using command line arguments.
+You should see something like:
+
+.. code-block:: bash
+
+ $ bin/cake bake -h
+
+ Bake generates code for your application. Different types of classes can
+ be generated with the subcommands listed below. For example run
+ bake controller --help to learn more about generating a
+ controller.
Usage:
- cake bake.bake [subcommand] [options]
+ cake bake [subcommand] [-h] [-q] [-v]
Subcommands:
- all Bake a complete MVC skeleton.
- behavior Bake a behavior class file.
- cell Bake a cell class file.
- component Bake a component class file.
- controller Bake a controller skeleton.
- fixture Generate fixtures for use with the test suite. You
- can use `bake fixture all` to bake all fixtures.
- form Bake a form class file.
- helper Bake a helper class file.
- mailer Bake a mailer class file.
- migration Bake migration class.
- migration_diff Bake migration class.
- migration_snapshot Bake migration snapshot class.
- model Bake table and entity classes.
- plugin Create the directory structure, AppController class
- and testing setup for a new plugin. Can create
- plugins in any of your bootstrapped plugin paths.
- seed Bake seed class.
- shell Bake a shell class file.
- shell_helper Bake a shell_helper class file.
- task Bake a task class file.
- template Bake views for a controller, using built-in or
- custom templates.
- test Bake test case skeletons for classes.
-
- To see help on a subcommand use `cake bake.bake [subcommand] --help`
+ all Generate all files.
+ behavior Generate behavior files.
+ cell Generate cell files.
+ command Generate command files.
+ component Generate component files.
+ controller Generate controller files.
+ controller all Generate controller files.
+ fixture Generate fixture files.
+ fixture all Generate fixture files.
+ form Generate form files.
+ helper Generate helper files.
+ mailer Generate mailer files.
+ middleware Generate middleware files.
+ model Generate model files.
+ model all Generate model files.
+ plugin Generate plugin files.
+ shell Generate shell files.
+ shell_helper Generate shell helper files.
+ task Generate task files.
+ template Generate template files.
+ template all Generate template files.
+ test Generate test files.
+
+ To see help on a subcommand use `cake bake [subcommand] --help`
Options:
- --connection, -c Database connection to use in conjunction with `bake
- all`. (default: default)
- --everything Bake a complete MVC skeleton, using all the available
- tables. Usage: "bake all --everything"
- --force, -f Force overwriting existing files without prompting.
- --help, -h Display this help.
- --plugin, -p Plugin to bake into.
- --prefix Prefix to bake controllers and templates into.
- --quiet, -q Enable quiet output.
- --tablePrefix Table prefix to be used in models.
- --theme, -t The theme to use when baking code. (choices:
- Bake|Migrations)
- --verbose, -v Enable verbose output.
+ --help, -h Display this help.
+ --quiet, -q Enable quiet output.
+ --verbose, -v Enable verbose output.
+
+ Older Shell based tasks will not be listed here, but can still be run.
+
+You can get more information on each command using the ``-h`` option. e.g:
+``bin/cake controller -h``.
Bake Themes
===========
diff --git a/en/console-and-shells/helpers.rst b/en/console-and-shells/helpers.rst
deleted file mode 100644
index d5df632fac..0000000000
--- a/en/console-and-shells/helpers.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-Shell Helpers
-#############
-
-Shell Helpers let you package up complex output generation code. See
-:ref:`command-helpers` for more information.
diff --git a/en/console-and-shells/upgrade-shell.rst b/en/console-and-shells/upgrade-shell.rst
deleted file mode 100644
index e8a40d0058..0000000000
--- a/en/console-and-shells/upgrade-shell.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-.. _upgrade-shell:
-
-Upgrade Shell
-#############
-
-The upgrade shell will do most of the work to upgrade your CakePHP application
-from 2.x to 3.x.
-
-It is provided by a standalone
-`Upgrade plugin `_. Please read the README
-file to get all information on how to upgrade your application.
-
-.. meta::
- :title lang=en: Upgrade Shell
- :keywords lang=en: api docs,shell,upgrade
diff --git a/en/console-and-shells.rst b/en/console-commands.rst
similarity index 57%
rename from en/console-and-shells.rst
rename to en/console-commands.rst
index 9ef39e0b26..2367e97a6a 100644
--- a/en/console-and-shells.rst
+++ b/en/console-commands.rst
@@ -1,40 +1,23 @@
-Console Tools, Shells & Tasks
-#############################
+Console Commands
+################
.. php:namespace:: Cake\Console
-CakePHP features not only a web framework but also a console framework for
-creating console applications. Console applications are ideal for handling a
-variety of background tasks such as maintenance, and completing work outside of
-the request-response cycle. CakePHP console applications allow you to reuse your
-application classes from the command line.
+In addition to a web framework, CakePHP also provides a console framework for
+creating command line tools & applications. Console applications are ideal for
+handling a variety of background & maintenance tasks that leverage your existing
+application configuratino, models, plugins and domain logic.
-CakePHP comes with a number of console applications out of the box. Some of
-these applications are used in concert with other CakePHP features (like i18n),
-and others are for general use to get you working faster.
+CakePHP provides several console tools for interacting with CakePHP features
+like i18n and routing that enable you to introspect your application and
+generate related files.
The CakePHP Console
===================
-This section provides an introduction into CakePHP at the command-line. Console
-tools are ideal for use in cron jobs, or command line based utilities that don't
-need to be accessible from a web browser.
-
-PHP provides a CLI client that makes interfacing with your file system and
-applications much smoother. The CakePHP console provides a framework for
-creating shell scripts. The Console uses a dispatcher-type setup to load a shell
-or task, and provide its parameters.
-
-.. note::
-
- A command-line (CLI) build of PHP must be available on the system
- if you plan to use the Console.
-
-Before we get into specifics, let's make sure you can run the CakePHP console.
-First, you'll need to bring up a system terminal. The examples shown in this
-section will be in bash, but the CakePHP Console is compatible with Windows as
-well. This example assumes that you are currently logged into a bash prompt at
-the root of your CakePHP application.
+The CakePHP Console uses a dispatcher-type system to load a commands, parse
+their arguments and invoke the correct command. While the examples below use
+bash the CakePHP console is compatible with any \*nix shell and windows.
A CakePHP application contains **src/Command**, **src/Shell** and
**src/Shell/Task** directories that contain its shells and tasks. It also
@@ -49,50 +32,8 @@ comes with an executable in the **bin** directory:
For Windows, the command needs to be ``bin\cake`` (note the backslash).
-.. deprecated:: 3.6.0
- Shells are deprecated as of 3.6.0, but will not be removed until 5.x.
- Use :doc:`/console-and-shells/commands` instead.
-
-Running the Console with no arguments produces this help message::
-
- Welcome to CakePHP v4.0.0 Console
- ---------------------------------------------------------------
- App : App
- Path: /Users/markstory/Sites/cakephp-app/src/
- ---------------------------------------------------------------
- Current Paths:
-
- * app: src
- * root: /Users/markstory/Sites/cakephp-app
- * core: /Users/markstory/Sites/cakephp-app/vendor/cakephp/cakephp
-
- Available Commands:
-
- - version
- - help
- - cache
- - completion
- - i18n
- - schema_cache
- - plugin
- - routes
- - server
- - bug
- - console
- - event
- - orm
- - bake
- - bake.bake
- - migrations
- - migrations.migrations
-
- To run a command, type `cake shell_name [args|options]`
- To get help on a specific command, type `cake shell_name --help`
-
-The first information printed relates to paths. This is helpful if you're
-running the console from different parts of the filesystem.
-
-You could then run the any of the listed commands by using its name:
+Running the Console with no arguments will list out available commands. You
+could then run the any of the listed commands by using its name:
.. code-block:: bash
@@ -185,17 +126,16 @@ available commands.
Commands
========
-See the :doc:`/console-and-shells/commands` chapter on how to create your first
+See the :doc:`/console-commands/commands` chapter on how to create your first
command. Then learn more about commands:
.. toctree::
:maxdepth: 1
- console-and-shells/commands
- console-and-shells/input-output
- console-and-shells/option-parsers
- console-and-shells/helpers
- console-and-shells/cron-jobs
+ console-commands/commands
+ console-commands/input-output
+ console-commands/option-parsers
+ console-commands/cron-jobs
CakePHP Provided Commands
=========================
@@ -203,16 +143,15 @@ CakePHP Provided Commands
.. toctree::
:maxdepth: 1
- console-and-shells/cache
- console-and-shells/i18n-shell
- console-and-shells/completion-shell
- console-and-shells/plugin-shell
- console-and-shells/routes-shell
- console-and-shells/schema-cache
- console-and-shells/server-shell
- console-and-shells/upgrade-shell
- console-and-shells/shells
- console-and-shells/repl
+ console-commands/cache
+ console-commands/i18n
+ console-commands/completion
+ console-commands/plugin
+ console-commands/routes
+ console-commands/schema-cache
+ console-commands/server
+ console-commands/shells
+ console-commands/repl
Routing in the Console Environment
==================================
diff --git a/en/console-and-shells/cache.rst b/en/console-commands/cache.rst
similarity index 95%
rename from en/console-and-shells/cache.rst
rename to en/console-commands/cache.rst
index 3173615382..c049f05e81 100644
--- a/en/console-and-shells/cache.rst
+++ b/en/console-commands/cache.rst
@@ -1,5 +1,5 @@
Cache Shell
-===========
+###########
To help you better manage cached data from a CLI environment, a shell command
is available for clearing cached data your application has::
diff --git a/en/console-and-shells/commands.rst b/en/console-commands/commands.rst
similarity index 96%
rename from en/console-and-shells/commands.rst
rename to en/console-commands/commands.rst
index b59724b8b5..83de99101e 100644
--- a/en/console-and-shells/commands.rst
+++ b/en/console-commands/commands.rst
@@ -1,5 +1,5 @@
-Console Commands
-################
+Command Objects
+###############
.. php:namespace:: Cake\Console
.. php:class:: Command
@@ -8,9 +8,6 @@ CakePHP comes with a number of built-in commands for speeding up your
development, and automating routine tasks. You can use these same libraries to
create commands for your application and plugins.
-.. versionadded:: 3.6.0
- Commands were added to replace Shells long term. Shells & Tasks have several shortcomings that are hard to correct without breaking compatibility.
-
Creating a Command
==================
@@ -112,14 +109,14 @@ add a ``yell`` option to our ``HelloCommand``::
$io->out("Hello {$name}.");
}
-See the :doc:`/console-and-shells/option-parsers` section for more information.
+See the :doc:`/console-commands/option-parsers` section for more information.
Creating Output
===============
Commands are provided a ``ConsoleIo`` instance when executed. This object allows
you to interact with ``stdout``, ``stderr`` and create files. See the
-:doc:`/console-and-shells/input-output` section for more information.
+:doc:`/console-commands/input-output` section for more information.
Using Models in Commands
========================
@@ -138,11 +135,8 @@ commands::
class UserCommand extends Command
{
- public function initialize(): void
- {
- parent::initialize();
- $this->loadModel('Users');
- }
+ // Base Command will load the Users model with this property defined.
+ public $modelClass = 'Users';
protected function buildOptionParser(ConsoleOptionParser $parser)
{
diff --git a/en/console-and-shells/completion-shell.rst b/en/console-commands/completion.rst
similarity index 99%
rename from en/console-and-shells/completion-shell.rst
rename to en/console-commands/completion.rst
index d15b3aeb66..91cbcb512e 100644
--- a/en/console-and-shells/completion-shell.rst
+++ b/en/console-commands/completion.rst
@@ -1,4 +1,4 @@
-Completion Shell
+Completion Tool
################
Working with the console gives the developer a lot of possibilities but having
diff --git a/en/console-and-shells/cron-jobs.rst b/en/console-commands/cron-jobs.rst
similarity index 92%
rename from en/console-and-shells/cron-jobs.rst
rename to en/console-commands/cron-jobs.rst
index 605a0183aa..ff0971e62b 100644
--- a/en/console-and-shells/cron-jobs.rst
+++ b/en/console-commands/cron-jobs.rst
@@ -25,9 +25,9 @@ You can see more info here: http://en.wikipedia.org/wiki/Cron
Cron Jobs on Shared Hosting
---------------------------
-On some shared hostings ``cd /full/path/to/root && bin/cake myshell myparam``
+On some shared hostings ``cd /full/path/to/root && bin/cake mycommand myparam``
might not work. Instead you can use
-``php /full/path/to/root/bin/cake.php myshell myparam``.
+``php /full/path/to/root/bin/cake.php mycommand myparam``.
.. note::
diff --git a/en/console-and-shells/i18n-shell.rst b/en/console-commands/i18n.rst
similarity index 85%
rename from en/console-and-shells/i18n-shell.rst
rename to en/console-commands/i18n.rst
index 58b36f181c..4986728de9 100644
--- a/en/console-and-shells/i18n-shell.rst
+++ b/en/console-commands/i18n.rst
@@ -1,11 +1,11 @@
-I18N Shell
-##########
+I18N Tool
+#########
The i18n features of CakePHP use `po files `_
as their translation source. PO files integrate with commonly used translation tools
like `Poedit `_.
-The i18n shell provides a quick and easy way to generate po template files.
+The i18n commands provides a quick and easy way to generate po template files.
These templates files can then be given to translators so they can translate the
strings in your application. Once you have translations done, pot files can be
merged with existing translations to help update your translations.
@@ -16,7 +16,9 @@ Generating POT Files
POT files can be generated for an existing application using the ``extract``
command. This command will scan your entire application for ``__()`` style
function calls, and extract the message string. Each unique string in your
-application will be combined into a single POT file::
+application will be combined into a single POT file:
+
+.. code-block:: bash
bin/cake i18n extract
@@ -28,7 +30,9 @@ correctly set the ``Plural-Forms`` header line.
Generating POT Files for Plugins
--------------------------------
-You can generate a POT file for a specific plugin using::
+You can generate a POT file for a specific plugin using:
+
+.. code-block:: bash
bin/cake i18n extract --plugin
@@ -42,7 +46,9 @@ your application. For instance, if you are defining some strings in the
``config`` directory of your application, you probably want to extract strings
from this directory as well as from the ``src`` directory. You can do it by
using the ``--paths`` option. It takes a comma-separated list of absolute paths
-to extract::
+to extract:
+
+.. code-block:: bash
bin/cake i18n extract --paths /var/www/app/config,/var/www/app/src
@@ -50,7 +56,9 @@ Excluding Folders
-----------------
You can pass a comma separated list of folders that you wish to be excluded.
-Any path containing a path segment with the provided values will be ignored::
+Any path containing a path segment with the provided values will be ignored:
+
+.. code-block:: bash
bin/cake i18n extract --exclude vendor,tests
@@ -58,7 +66,9 @@ Skipping Overwrite Warnings for Existing POT Files
--------------------------------------------------
By adding ``--overwrite``, the shell script will no longer warn you if a POT
-file already exists and will overwrite by default::
+file already exists and will overwrite by default:
+
+.. code-block:: bash
bin/cake i18n extract --overwrite
@@ -67,7 +77,9 @@ Extracting Messages from the CakePHP Core Libraries
By default, the extract shell script will ask you if you like to extract
the messages used in the CakePHP core libraries. Set ``--extract-core`` to yes
-or no to set the default behavior::
+or no to set the default behavior:
+
+.. code-block:: bash
bin/cake i18n extract --extract-core yes
diff --git a/en/console-and-shells/input-output.rst b/en/console-commands/input-output.rst
similarity index 99%
rename from en/console-and-shells/input-output.rst
rename to en/console-commands/input-output.rst
index c25fe9427d..60b8815b8d 100644
--- a/en/console-and-shells/input-output.rst
+++ b/en/console-commands/input-output.rst
@@ -1,5 +1,5 @@
Command Input/Output
-====================
+####################
.. php:namespace:: Cake\Console
.. php:class:: ConsoleIo
diff --git a/en/console-and-shells/option-parsers.rst b/en/console-commands/option-parsers.rst
similarity index 85%
rename from en/console-and-shells/option-parsers.rst
rename to en/console-commands/option-parsers.rst
index 56eddd1970..04b10d65c4 100644
--- a/en/console-and-shells/option-parsers.rst
+++ b/en/console-commands/option-parsers.rst
@@ -131,11 +131,11 @@ When creating options you can use the following options to define the behavior
of the option:
* ``short`` - The single letter variant for this option, leave undefined for
- none.
+ none.
* ``help`` - Help text for this option. Used when generating help for the
- option.
+ option.
* ``default`` - The default value for this option. If not defined the default
- will be ``true``.
+ will be ``true``.
* ``boolean`` - The option uses no value, it's just a boolean switch.
Defaults to ``false``.
* ``choices`` - An array of valid choices for this option. If left empty all
@@ -158,10 +158,6 @@ to add multiple options at once. ::
As with all the builder methods on ConsoleOptionParser, addOptions can be used
as part of a fluent method chain.
-Option values are stored in the ``$this->params`` array. You can also use the
-convenience method ``$this->param()`` to avoid errors when trying to access
-non-present options.
-
Validating Options
------------------
@@ -376,50 +372,3 @@ can set the value of the epilog::
// Read the current value
$parser->getEpilog();
-
-
-Adding Subcommands
-------------------
-
-.. php:method:: addSubcommand($name, $options = [])
-
-Console applications are often made of subcommands, and these subcommands may
-require special option parsing and have their own help. A perfect example of
-this is ``bake``. Bake is made of many separate tasks that all have their own
-help and options. ``ConsoleOptionParser`` allows you to define subcommands and
-provide command specific option parsers so the shell knows how to parse commands
-for its tasks::
-
- $parser->addSubcommand('model', [
- 'help' => 'Bake a model',
- 'parser' => $this->Model->getOptionParser()
- ]);
-
-The above is an example of how you could provide help and a specialized option
-parser for a shell's task. By calling the Task's ``getOptionParser()`` we don't
-have to duplicate the option parser generation, or mix concerns in our shell.
-Adding subcommands in this way has two advantages. First, it lets your shell
-document its subcommands in the generated help. It also gives easy access to the
-subcommand help. With the above subcommand created you could call
-``cake myshell --help`` and see the list of subcommands, and also run
-``cake myshell model --help`` to view the help for just the model task.
-
-.. note::
-
- Once your Shell defines subcommands, all subcommands must be explicitly
- defined.
-
-When defining a subcommand you can use the following options:
-
-* ``help`` - Help text for the subcommand.
-* ``parser`` - A ConsoleOptionParser for the subcommand. This allows you to
- create method specific option parsers. When help is generated for a
- subcommand, if a parser is present it will be used. You can also supply the
- parser as an array that is compatible with
- :php:meth:`Cake\\Console\\ConsoleOptionParser::buildFromArray()`
-
-Adding subcommands can be done as part of a fluent method chain.
-
-.. deprecated:: 3.6.0
- Subcommands are deprecated and will be removed in 5.0.
- Instead use :ref:`nested commands `.
diff --git a/en/console-and-shells/plugin-shell.rst b/en/console-commands/plugin.rst
similarity index 69%
rename from en/console-and-shells/plugin-shell.rst
rename to en/console-commands/plugin.rst
index 276ba8e817..010de4cf10 100644
--- a/en/console-and-shells/plugin-shell.rst
+++ b/en/console-commands/plugin.rst
@@ -1,10 +1,12 @@
.. _plugin-shell:
-Plugin Shell
-############
+Plugin Tool
+###########
-The plugin shell allows you to load and unload plugins via the command prompt.
-If you need help, run::
+The plugin tool allows you to load and unload plugins via the command prompt.
+If you need help, run:
+
+.. code-block:: bash
bin/cake plugin --help
@@ -12,7 +14,9 @@ Loading Plugins
---------------
Via the ``Load`` task you are able to load plugins in your
-**config/bootstrap.php**. You can do this by running::
+**config/bootstrap.php**. You can do this by running:
+
+.. code-block:: bash
bin/cake plugin load MyPlugin
@@ -22,7 +26,9 @@ This will add the following to your **src/Application.php**::
$this->addPlugin('MyPlugin');
If you are loading a plugin that only provides CLI tools - like bake - you can
-update your ``bootstrap_cli.php`` with::
+update your ``bootstrap_cli.php`` with:
+
+.. code-block:: bash
bin/cake plugin load --cli MyPlugin
bin/cake plugin unload --cli MyPlugin
@@ -30,7 +36,9 @@ update your ``bootstrap_cli.php`` with::
Unloading Plugins
-----------------
-You can unload a plugin by specifying its name::
+You can unload a plugin by specifying its name:
+
+.. code-block:: bash
bin/cake plugin unload MyPlugin
@@ -43,7 +51,9 @@ Plugin Assets
CakePHP by default serves plugins assets using the ``AssetMiddleware`` middleware.
While this is a good convenience, it is recommended to symlink / copy
the plugin assets under app's webroot so that they can be directly served by the
-web server without invoking PHP. You can do this by running::
+web server without invoking PHP. You can do this by running:
+
+.. code-block:: bash
bin/cake plugin assets symlink
@@ -51,10 +61,12 @@ Running the above command will symlink all plugins assets under app's webroot.
On Windows, which doesn't support symlinks, the assets will be copied in
respective folders instead of being symlinked.
-You can symlink assets of one particular plugin by specifying its name::
+You can symlink assets of one particular plugin by specifying its name:
+
+.. code-block:: bash
bin/cake plugin assets symlink MyPlugin
.. meta::
- :title lang=en: Plugin Shell
- :keywords lang=en: plugin,assets,shell,load,unload
+ :title lang=en: Plugin tool
+ :keywords lang=en: plugin,assets,tool,load,unload
diff --git a/en/console-and-shells/repl.rst b/en/console-commands/repl.rst
similarity index 74%
rename from en/console-and-shells/repl.rst
rename to en/console-commands/repl.rst
index 584b2ba8ff..9fda277c61 100644
--- a/en/console-and-shells/repl.rst
+++ b/en/console-commands/repl.rst
@@ -3,21 +3,20 @@ Interactive Console (REPL)
The CakePHP app skeleton comes with a built in REPL(Read Eval Print Loop) that
makes it easy to explore some CakePHP and your application in an interactive
-console. You can start the interactive console using::
+console. You can start the interactive console using:
- $ bin/cake console
+.. code-block:: bash
+
+ bin/cake console
This will bootstrap your application and start an interactive console. At this
point you can interact with your application code and execute queries using your
-application's models::
+application's models:
+
+.. code-block:: bash
- $ bin/cake console
+ bin/cake console
- Welcome to CakePHP v3.0.0 Console
- ---------------------------------------------------------------
- App : App
- Path: /Users/mark/projects/cakephp-app/src/
- ---------------------------------------------------------------
>>> $articles = Cake\ORM\TableRegistry::get('Articles');
// object(Cake\ORM\Table)(
//
diff --git a/en/console-and-shells/routes-shell.rst b/en/console-commands/routes.rst
similarity index 76%
rename from en/console-and-shells/routes-shell.rst
rename to en/console-commands/routes.rst
index f4f91525eb..3ffd976f69 100644
--- a/en/console-and-shells/routes-shell.rst
+++ b/en/console-commands/routes.rst
@@ -1,26 +1,30 @@
-Routes Shell
-############
+Routes Tool
+###########
-The RoutesShell provides a simple to use CLI interface for testing and debugging
+The routes tool provides a simple to use CLI interface for testing and debugging
routes. You can use it to test how routes are parsed, and what URLs routing
parameters will generate.
Getting a List of all Routes
----------------------------
-::
+.. code-block:: bash
bin/cake routes
Testing URL parsing
-------------------
-You can quickly see how a URL will be parsed using the ``check`` method::
+You can quickly see how a URL will be parsed using the ``check`` method:
+
+.. code-block:: bash
bin/cake routes check /bookmarks/edit/1
If your route contains any query string parameters remember to surround the URL
-in quotes::
+in quotes:
+
+.. code-block:: bash
bin/cake routes check "/bookmarks/?page=1&sort=title&direction=desc"
@@ -28,7 +32,9 @@ Testing URL Generation
----------------------
You can see how which URL a :term:`routing array` will generate using the
-``generate`` method::
+``generate`` method:
+
+.. code-block:: bash
bin/cake routes generate controller:Bookmarks action:edit 1
diff --git a/en/console-and-shells/schema-cache.rst b/en/console-commands/schema-cache.rst
similarity index 81%
rename from en/console-and-shells/schema-cache.rst
rename to en/console-commands/schema-cache.rst
index 28629601d8..b263494282 100644
--- a/en/console-and-shells/schema-cache.rst
+++ b/en/console-commands/schema-cache.rst
@@ -1,21 +1,27 @@
-Schema Cache Shell
-##################
+Schema Cache Tool
+#################
The SchemaCacheShell provides a simple CLI tool for managing your application's
metadata caches. In deployment situations it is helpful to rebuild the metadata
cache in-place without clearing the existing cache data. You can do this by
-running::
+running:
+
+.. code-block:: bash
bin/cake schema_cache build --connection default
This will rebuild the metadata cache for all tables on the ``default``
connection. If you only need to rebuild a single table you can do that by
-providing its name::
+providing its name:
+
+.. code-block:: bash
bin/cake schema_cache build --connection default articles
In addition to building cached data, you can use the SchemaCacheShell to remove
-cached metadata as well::
+cached metadata as well:
+
+.. code-block:: bash
# Clear all metadata
bin/cake schema_cache clear
diff --git a/en/console-and-shells/server-shell.rst b/en/console-commands/server.rst
similarity index 78%
rename from en/console-and-shells/server-shell.rst
rename to en/console-commands/server.rst
index cc35b96d1d..3fd27ac059 100644
--- a/en/console-and-shells/server-shell.rst
+++ b/en/console-commands/server.rst
@@ -4,9 +4,11 @@ Server Shell
The ``ServerShell`` lets you stand up a simple webserver using the built in PHP
webserver. While this server is *not* intended for production use it can
be handy in development when you want to quickly try an idea out and don't want
-to spend time configuring Apache or Nginx. You can start the server shell with::
+to spend time configuring Apache or Nginx. You can start the server shell with:
- $ bin/cake server
+.. code-block:: bash
+
+ bin/cake server
You should see the server boot up and attach to port 8765. You can visit the
CLI server by visiting ``http://localhost:8765``
@@ -20,7 +22,9 @@ terminal.
Changing the Port and Document Root
===================================
-You can customize the port and document root using options::
+You can customize the port and document root using options:
+
+.. code-block:: bash
- $ bin/cake server --port 8080 --document_root path/to/app
+ bin/cake server --port 8080 --document_root path/to/app
diff --git a/en/console-and-shells/shells.rst b/en/console-commands/shells.rst
similarity index 97%
rename from en/console-and-shells/shells.rst
rename to en/console-commands/shells.rst
index c209c29be9..f19d032970 100644
--- a/en/console-and-shells/shells.rst
+++ b/en/console-commands/shells.rst
@@ -7,7 +7,7 @@ Shells
.. deprecated:: 3.6.0
Shells are deprecated as of 3.6.0, but will not be removed until 5.x.
- Use :doc:`/console-and-shells/commands` instead.
+ Use :doc:`/console-commands/commands` instead.
Creating a Shell
================
@@ -208,7 +208,7 @@ Shell Helpers
=============
If you have complex output generation logic, you can use
-:doc:`/console-and-shells/helpers` to encapsulate this logic in a re-usable way.
+:ref:`command-helpers` to encapsulate this logic in a re-usable way.
.. _invoking-other-shells-from-your-shell:
@@ -264,14 +264,14 @@ the CakePHP console welcome message from being displayed on dispatched shells.
Parsing CLI Options
===================
-Shells use :doc:`/console-and-shells/option-parsers` to define their options,
+Shells use :doc:`/console-commands/option-parsers` to define their options,
arguments and automate help generation.
Interacting with Input/Output
=============================
Shells allow you to access a ``ConsoleIo`` instance via the ``getIo()`` method.
-See the :doc:`/console-and-shells/input-output` section for more information.
+See the :doc:`/console-commands/input-output` section for more information.
In addition to the ``ConsoleIo`` object, Shell classes offer a suite of shortcut
methods. These methods are shortcuts and aliases to those found on ``ConsoleIo``::
diff --git a/en/contents.rst b/en/contents.rst
index 73c611e8c8..9dd2fc159c 100644
--- a/en/contents.rst
+++ b/en/contents.rst
@@ -38,7 +38,7 @@ Contents
controllers/components/authentication
bake
core-libraries/caching
- console-and-shells
+ console-commands
development/debugging
deployment
core-libraries/email
diff --git a/en/controllers/middleware.rst b/en/controllers/middleware.rst
index 6e562b5ca2..d881313da9 100644
--- a/en/controllers/middleware.rst
+++ b/en/controllers/middleware.rst
@@ -60,10 +60,9 @@ Middleware can be applied to your application globally, or to individual
routing scopes.
To apply middleware to all requests, use the ``middleware`` method of your
-``App\Application`` class. If you don't have an ``App\Application`` class, see
-the section on :ref:`adding-http-stack` for more information. Your application's
-``middleware`` hook method will be called at the beginning of the request
-process, you can use the ``MiddlewareQueue`` object to attach middleware::
+``App\Application`` class. Your application's ``middleware`` hook method will be
+called at the beginning of the request process, you can use the
+``MiddlewareQueue`` object to attach middleware::
namespace App;
diff --git a/en/core-libraries/caching.rst b/en/core-libraries/caching.rst
index b74a753cdc..e943032c95 100644
--- a/en/core-libraries/caching.rst
+++ b/en/core-libraries/caching.rst
@@ -22,19 +22,21 @@ build your own backend. The built-in caching engines are:
atomic operations. However, since disk storage is often quite cheap,
storing large objects, or elements that are infrequently written
work well in files.
+* ``Memcached`` Uses the `Memcached `_
+ extension.
+* ``Redis`` Uses the `phpredis `_
+ extension. Redis provides a fast and persistent cache system similar to
+ Memcached, also provides atomic operations.
* ``Apcu`` APCu cache uses the PHP `APCu `_ extension.
This extension uses shared memory on the webserver to store objects.
This makes it very fast, and able to provide atomic read/write features.
* ``Wincache`` Wincache uses the `Wincache `_
extension. Wincache is similar to APC in features and performance, but
optimized for Windows and IIS.
-* ``Memcached`` Uses the `Memcached `_
- extension.
-* ``Redis`` Uses the `phpredis `_
- extension. Redis provides a fast and persistent cache system similar to
- Memcached, also provides atomic operations.
* ``Array`` Stores all data in an array. This engine does not provide
persistent storage and is intended for use in application test suites.
+* ``Null`` The null engine doesn't actually store anything and fails all read
+ operations.
Regardless of the CacheEngine you choose to use, your application interacts with
:php:class:`Cake\\Cache\\Cache`.
@@ -137,10 +139,10 @@ Engine Options
Each engine accepts the following options:
-* ``duration`` Specify how long items in this cache configuration last.
+* ``duration`` Specify a default duration for how long items are valid.
Specified as a ``strototime()`` compatible expression.
* ``groups`` List of groups or 'tags' associated to every key stored in this
- config. handy for deleting a complete group from cache.
+ config. Useful when you need to delete a subset of data from a cache.
* ``prefix`` Prepended to all entries. Good for when you need to share
a keyspace with either another cache config or another application.
* ``probability`` Probability of hitting a cache gc cleanup. Setting to 0 will disable
diff --git a/en/core-libraries/internationalization-and-localization.rst b/en/core-libraries/internationalization-and-localization.rst
index bc1e157568..36eb2b833b 100644
--- a/en/core-libraries/internationalization-and-localization.rst
+++ b/en/core-libraries/internationalization-and-localization.rst
@@ -95,7 +95,7 @@ Extract Pot Files with I18n Shell
To create the pot files from `__()` and other internationalized types of
messages that can be found in the application code, you can use the i18n shell.
-Please read the :doc:`following chapter ` to
+Please read the :doc:`following chapter ` to
learn more.
Setting the Default Locale
@@ -594,7 +594,7 @@ Parsing Localized Datetime Data
When accepting localized data from the request, it is nice to accept datetime
information in a user's localized format. In a controller, or
-:doc:`/development/dispatch-filters` you can configure the Date, Time, and
+:doc:`/development/middleware` you can configure the Date, Time, and
DateTime types to parse localized formats::
use Cake\Database\Type;
diff --git a/en/deployment.rst b/en/deployment.rst
index 60ed67cb46..243e5edccb 100644
--- a/en/deployment.rst
+++ b/en/deployment.rst
@@ -62,7 +62,7 @@ Check Your Security
If you're throwing your application out into the wild, it's a good idea to make
sure it doesn't have any obvious leaks:
-* Ensure you are using the :doc:`/controllers/components/csrf` component or middleware.
+* Ensure you are using the :ref:`csrf-middleware` component or middleware.
* You may want to enable the :doc:`/controllers/components/security` component.
It can help prevent several types of form tampering and reduce the possibility
of mass-assignment issues.
@@ -118,7 +118,7 @@ Deploying an update
===================
After deployment of an update you might also want to run ``bin/cake schema_cache
-clear``, part of the :doc:`/console-and-shells/schema-cache` shell.
+clear``, part of the :doc:`/console-commands/schema-cache` shell.
.. meta::
:title lang=en: Deployment
diff --git a/en/development/application.rst b/en/development/application.rst
index 5782b606b4..f7dcc5b667 100644
--- a/en/development/application.rst
+++ b/en/development/application.rst
@@ -17,7 +17,7 @@ methods:
* ``routes`` Used to load :doc:`routes `. By default this
will include **config/routes.php**.
* ``middleware`` Used to add :doc:`middleware ` to your application.
-* ``console`` Used to add :doc:`console commands ` to your
+* ``console`` Used to add :doc:`console commands ` to your
application. By default this will automatically discover shells & commands in
your application and all plugins.
diff --git a/en/epub-contents.rst b/en/epub-contents.rst
index a8ac806b0b..f016c452de 100644
--- a/en/epub-contents.rst
+++ b/en/epub-contents.rst
@@ -23,7 +23,7 @@ Contents
controllers/components/authentication
core-libraries/caching
bake
- console-and-shells
+ console-commands
development/debugging
deployment
core-libraries/email
diff --git a/en/intro/cakephp-folder-structure.rst b/en/intro/cakephp-folder-structure.rst
index 1c07ed6350..ab7f994fac 100644
--- a/en/intro/cakephp-folder-structure.rst
+++ b/en/intro/cakephp-folder-structure.rst
@@ -41,7 +41,7 @@ development. Let's look a little closer at the folders inside
Command
Contains your application's console commands. See
- :doc:`/console-and-shells/commands` to learn more.
+ :doc:`/console-commands/commands` to learn more.
Console
Contains the installation script executed by Composer.
Controller
@@ -54,7 +54,7 @@ Model
Contains your application's tables, entities and behaviors.
Shell
Contains shell tasks for your application.
- For more information see :doc:`/console-and-shells`.
+ For more information see :doc:`/console-commands/shells`.
View
Presentational classes are placed here: views, cells, helpers.
diff --git a/en/migrations.rst b/en/migrations.rst
index d79cad3c5f..5e4450833d 100644
--- a/en/migrations.rst
+++ b/en/migrations.rst
@@ -920,12 +920,12 @@ If you use the plugin when deploying your application, be sure to clear the ORM
cache so it renews the column metadata of your tables.
Otherwise, you might end up having errors about columns not existing when
performing operations on those new columns.
-The CakePHP Core includes a :doc:`Schema Cache Shell `
+The CakePHP Core includes a :doc:`Schema Cache Shell `
that you can use to perform this operation::
$ bin/cake schema_cache clear
-Be sure to read the :doc:`Schema Cache Shell `
+Be sure to read the :doc:`Schema Cache Shell `
section of the cookbook if you want to know more about this shell.
Renaming a table
diff --git a/en/orm.rst b/en/orm.rst
index c974680f3a..12e4496cf4 100644
--- a/en/orm.rst
+++ b/en/orm.rst
@@ -22,12 +22,6 @@ both patterns to create a fast, simple to use ORM.
Before we get started exploring the ORM, make sure you :ref:`configure your
database connections `.
-.. note::
-
- If you are familiar with previous versions of CakePHP, you should read the
- :doc:`/appendices/orm-migration` for important differences between CakePHP 3.0
- and older versions of CakePHP.
-
Quick Example
=============
@@ -124,4 +118,4 @@ More Information
orm/associations
orm/behaviors
orm/schema-system
- console-and-shells/schema-cache
+ console-commands/schema-cache
diff --git a/en/orm/behaviors/translate.rst b/en/orm/behaviors/translate.rst
index 3ed1ff3eb7..55df4193fe 100644
--- a/en/orm/behaviors/translate.rst
+++ b/en/orm/behaviors/translate.rst
@@ -19,11 +19,11 @@ Translation Strategies
The behavior offers two strategies for how the translations are stored.
1. Eav Strategy: This strategy uses a ``i18n`` table where it stores the
- translation for each of the fields of any given Table object that it's bound to.
- This is currently the default strategy used by the behavior.
+ translation for each of the fields of any given Table object that it's bound to.
+ This is currently the default strategy used by the behavior.
2. Shadow table Strategy: This strategy use a separate "shadow table" for each
- Table object to store translation of all translated fields of that table.
+ Table object to store translation of all translated fields of that table.
Eav Strategy
diff --git a/en/orm/database-basics.rst b/en/orm/database-basics.rst
index 626118aeac..f89ce59ecd 100644
--- a/en/orm/database-basics.rst
+++ b/en/orm/database-basics.rst
@@ -934,7 +934,7 @@ You can also configure the metadata caching at runtime with the
$connection->cacheMetadata('orm_metadata');
CakePHP also includes a CLI tool for managing metadata caches. See the
-:doc:`/console-and-shells/schema-cache` chapter for more information.
+:doc:`/console-commands/schema-cache` chapter for more information.
Creating Databases
==================
diff --git a/en/pdf-contents.rst b/en/pdf-contents.rst
index 187fb362c1..3832ac96cd 100644
--- a/en/pdf-contents.rst
+++ b/en/pdf-contents.rst
@@ -23,7 +23,7 @@ Contents
controllers/components/authentication
core-libraries/caching
bake
- console-and-shells
+ console-commands
development/debugging
deployment
core-libraries/email
diff --git a/en/topics.rst b/en/topics.rst
index a576f87124..e880c33038 100644
--- a/en/topics.rst
+++ b/en/topics.rst
@@ -26,13 +26,13 @@ Introduction to all the key parts of CakePHP:
* :doc:`/development/rest`
* :doc:`/controllers/components/authentication`
* :doc:`/controllers/components/pagination`
-* :doc:`/controllers/components/csrf`
+* :ref:`csrf-middleware`
* :doc:`/core-libraries/email`
* :doc:`/views/helpers/form`
* :doc:`/views/helpers/html`
* :doc:`/core-libraries/validation`
* :doc:`/development/testing`
* :doc:`/deployment`
-* :doc:`/console-and-shells`
+* :doc:`/console-commands`
* :doc:`/contributing`
* :doc:`/tutorials-and-examples`