Skip to content

Commit de957f7

Browse files
committed
minor #10445 Add deprecation notice for --env and --no-debug (hiddewie)
This PR was merged into the master branch. Discussion ---------- Add deprecation notice for --env and --no-debug Fix #10444. - Add deprecation notice for `--env` and `--no-debug`. - Update some command examples to use the `APP_ENV` & `APP_DEBUG` environment variables. Commits ------- 77e3522 Add deprecation notice for --env and --no-debug
2 parents 82980e1 + 77e3522 commit de957f7

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

configuration/environments.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,23 @@ Selecting the Environment for Console Commands
178178

179179
By default, Symfony commands are executed in whatever environment is defined by
180180
the ``APP_ENV`` environment variable (usually configured in your ``.env`` file).
181+
You can override this by changing the value it before your command executes.
181182

182-
Use the ``--env`` and ``--no-debug`` options to modify this behavior:
183+
.. versionadded:: 4.2
184+
In Symfony 4.2 the command line options ``--env`` and ``--no-debug`` have been deprecated.
185+
Use the environment variables ``APP_ENV`` to set the environment and ``APP_DEBUG`` (set
186+
to the value ``0``) to disable debugging instead.
183187

184188
.. code-block:: terminal
185189
186190
# 'dev' environment and debug enabled
187191
$ php bin/console command_name
188192
189193
# 'prod' environment (debug is always disabled for 'prod')
190-
$ php bin/console command_name --env=prod
194+
$ APP_ENV=prod php bin/console command_name
191195
192196
# 'test' environment and debug disabled
193-
$ php bin/console command_name --env=test --no-debug
197+
$ APP_ENV=test APP_DEBUG=0 php bin/console command_name
194198
195199
.. index::
196200
single: Environments; Creating a new environment

deployment.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Make sure you clear and warm-up your Symfony cache:
168168

169169
.. code-block:: terminal
170170
171-
$ php bin/console cache:clear --env=prod --no-debug
171+
$ APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear
172172
173173
E) Other Things!
174174
~~~~~~~~~~~~~~~~

email/spool.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ There is a console command to send the messages in the spool:
127127

128128
.. code-block:: terminal
129129
130-
$ php bin/console swiftmailer:spool:send --env=prod
130+
$ APP_ENV=prod php bin/console swiftmailer:spool:send
131131
132132
It has an option to limit the number of messages to be sent:
133133

134134
.. code-block:: terminal
135135
136-
$ php bin/console swiftmailer:spool:send --message-limit=10 --env=prod
136+
$ APP_ENV=prod php bin/console swiftmailer:spool:send --message-limit=10
137137
138138
You can also set the time limit in seconds:
139139

140140
.. code-block:: terminal
141141
142-
$ php bin/console swiftmailer:spool:send --time-limit=10 --env=prod
142+
$ APP_ENV=prod php bin/console swiftmailer:spool:send --time-limit=10
143143
144144
Of course you will not want to run this manually in reality. Instead, the
145145
console command should be triggered by a cron job or scheduled task and run

testing/bootstrap.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ To do this, first add a file that executes your bootstrap work::
1212
if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) {
1313
// executes the "php bin/console cache:clear" command
1414
passthru(sprintf(
15-
'php "%s/../bin/console" cache:clear --env=%s --no-warmup',
16-
__DIR__,
17-
$_ENV['BOOTSTRAP_CLEAR_CACHE_ENV']
15+
'APP_ENV=%s php "%s/../bin/console" cache:clear --no-warmup',
16+
$_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'],
17+
__DIR__
1818
));
1919
}
2020

0 commit comments

Comments
 (0)