8000 Merge branch '5.2' into 5.x · symfony/symfony-docs@a45d678 · GitHub
[go: up one dir, main page]

Skip to content

Commit a45d678

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: [Notifier] Update information for slack on actual implementation Update http_cache.rst [Security] Minor typo [Console] Update questionhelper.rst Rewords Update index.rst [Validator] Removing the recommended `Constraints` subdirectory Fix code example Update database.rst Fixing uppercase typo Update performance.rst Tweaks Update messenger.rst Delete duplicated words [Notifier] Add better example for Slack DSN Update events.rst Enhancement: Add /me to the CODEOWNERS file for GithubActions workflows A method call is reversed Add a note about exposing env vars for unrecognized Docker services Update event_dispatcher.rst
2 parents 29c9eda + aece272 commit a45d678

File tree

15 files changed

+58
-39
lines changed

15 files changed

+58
-39
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# GithubActions workflows
2+
/.github/workflows* @OskarStark
3+
14
# Console
25
/console* @chalasr
36
/components/console* @chalasr

components/console/helpers/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ The Console Helpers
1515
debug_formatter
1616

1717
The Console component comes with some useful helpers. These helpers contain
18-
function to ease some common tasks.
18+
functions to ease some common tasks.
1919

2020
.. include:: map.rst.inc

components/console/helpers/progressbar.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ placeholder before displaying the progress bar::
348348
$progressBar->start();
349349
// 0/100 -- Start
350350

351-
$progressBar->advance();
352351
$progressBar->setMessage('Task is in progress...');
352+
$progressBar->advance();
353353
// 1/100 -- Task is in progress...
354354

355355
Messages can be combined with custom placeholders too. In this example, the

components/console/helpers/questionhelper.rst

Lines chang 6D40 ed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ helper set, which you can get by calling
1212
$helper = $this->getHelper('question');
1313

1414
The Question Helper has a single method
15-
:method:`Symfony\\Component\\Console\\Command\\Command::ask` that needs an
15+
:method:`Symfony\\Component\\Console\\Helper\\QuestionHelper::ask` that needs an
1616
:class:`Symfony\\Component\\Console\\Input\\InputInterface` instance as the
1717
first argument, an :class:`Symfony\\Component\\Console\\Output\\OutputInterface`
1818
instance as the second argument and a

doctrine/events.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on other common tasks (e.g. ``loadClassMetadata``, ``onClear``).
1616

1717
There are different ways to listen to these Doctrine events:
1818

19-
* **Lifecycle callbacks**, they are defined as methods on the entity classes and
19+
* **Lifecycle callbacks**, they are defined as public methods on the entity classes and
2020
they are called when the events are triggered;
2121
* **Lifecycle listeners and subscribers**, they are classes with callback
2222
methods for one or more events and they are called for all entities;
@@ -46,7 +46,7 @@ to learn everything about them.
4646
Doctrine Lifecycle Callbacks
4747
----------------------------
4848

49-
Lifecycle callbacks are defined as methods inside the entity you want to modify.
49+
Lifecycle callbacks are defined as public methods inside the entity you want to modify.
5050
For example, suppose you want to set a ``createdAt`` date column to the current
5151
date, but only when the entity is first persisted (i.e. inserted). To do so,
5252
define a callback for the ``prePersist`` Doctrine event:

event_dispatcher.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ using a special "tag":
108108
$services = $configurator->services();
109109
110110
$services->set(ExceptionListener::class)
111-
->addTag('kernel.event_listener', ['event' => 'kernel.exception'])
111+
->tag('kernel.event_listener', ['event' => 'kernel.exception'])
112112
;
113113
};
114114

http_cache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Safe Methods: Only caching GET or HEAD requests
310310
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311311

312312
HTTP caching only works for "safe" HTTP methods (like GET and HEAD). This means
313-
two things:
313+
three things:
314314

315315
* Don't try to cache PUT or DELETE requests. It won't work and with good reason.
316316
These methods are meant to be used when mutating the state of your application

messenger.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ The transport has a number of options:
13391339
====================== ====================================== ===================================
13401340
``access_key`` AWS access key
13411341
``account`` Identifier of the AWS account The owner of the credentials
1342-
``auto_setup`` Whether the table should be created ``true``
1342+
``auto_setup`` Whether the queue should be created ``true``
13431343
automatically during send / get.
13441344
``buffer_size`` Number of messages to prefetch 9
13451345
``endpoint`` Absolute URL to the SQS service https://sqs.eu-west-1.amazonaws.com

notifier.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,27 +145,26 @@ GoogleChat ``symfony/google-chat-notifier`` ``googlechat://ACCESS_KEY:ACCESS_T
145145
LinkedIn ``symfony/linked-in-notifier`` ``linkedin://TOKEN:USER_ID@default``
146146
Mattermost ``symfony/mattermost-notifier`` ``mattermost://TOKEN@ENDPOINT?channel=CHANNEL``
147147
RocketChat ``symfony/rocket-chat-notifier`` ``rocketchat://TOKEN@ENDPOINT?channel=CHANNEL``
148-
Slack ``symfony/slack-notifier`` ``slack://default/ID``
148+
Slack ``symfony/slack-notifier`` ``slack://TOKEN@default?channel=CHANNEL``
149149
Telegram ``symfony/telegram-notifier`` ``telegram://TOKEN@default?channel=CHAT_ID``
150150
Zulip ``symfony/zulip-notifier`` ``zulip://EMAIL:APIKEY@ENDPOINT?channel=CHANNEL``
151151
========== ================================ ===========================================================================
152152

153153
.. versionadded:: 5.1
154154

155-
The Mattermost and RocketChat integrations were introduced in Symfony
156-
5.1. The Slack DSN changed in Symfony 5.1 to use Slack Incoming
157-
Webhooks instead of legacy tokens.
155+
The Mattermost and RocketChat integrations were introduced in Symfony 5.1.
158156

159157
.. versionadded:: 5.2
160158

161159
The GoogleChat, LinkedIn, Zulip and Discord integrations were introduced in Symfony 5.2.
160+
The Slack DSN changed in Symfony 5.2 to use Slack Web API again same as in 5.0.
162161

163162
Chatters are configured using the ``chatter_transports`` setting:
164163

165164
.. code-block:: bash
166165
167166
# .env
168-
SLACK_DSN=slack://default/ID
167+
SLACK_DSN=slack://TOKEN@default?channel=CHANNEL
169168
170169
.. configuration-block::
171170

performance.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ such as Symfony projects, should use at least these values:
193193
Optimize Composer Autoloader
194194
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195195

196-
The class loader used while developing the application is optimized to find
197-
new and changed classes. In production servers, PHP files should never change,
196+
The class loader used while developing the application is optimized to find new
197+
and changed classes. In production servers, PHP files should never change,
198198
unless a new application version is deployed. That's why you can optimize
199-
Composer's autoloader to scan the entire application once and build a "class map",
200-
which is a big array of the locations of all the classes and it's stored
201-
in ``vendor/composer/autoload_classmap.php``.
199+
Composer's autoloader to scan the entire application once and build an
200+
optimized "class map", which is a big array of the locations of all the classes
201+
and it's stored in ``vendor/composer/autoload_classmap.php``.
202202

203-
Execute this command to generate the class map (and make it part of your
203+
Execute this command to generate the new class map (and make it part of your
204204
deployment process too):
205205

206206
.. code-block:: terminal

security/experimental_authenticators.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ The authenticator can be enabled using the ``custom_authenticators`` setting:
375375
- App\Security\ApiKeyAuthenticator
376376
377377
# don't forget to also configure the entry_point if the
378-
# authenticator implements AuthenticatorEntryPointInterface
378+
# authenticator implements AuthenticationEntryPointInterface
379379
# entry_point: App\Security\CustomFormLoginAuthenticator
380380
381381
.. code-block:: xml
@@ -447,7 +447,7 @@ well as other pieces of information, like whether a password should be checked
447447
or if "remember me" functionality should be enabled.
448448

449449
The default
450-
:class:`Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Passport`.
450+
:class:`Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Passport`
451451
requires a user object and credentials. The following credential classes
452452
are supported by default:
453453

service_container/tags.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,9 @@ indexed by the ``key`` attribute:
785785
};
786786
787787
After compilation the ``HandlerCollection`` is able to iterate over your
788-
application handlers. To retrieve a specific service by it's ``key`` attribute
789-
from the iterator, we can use ``iterator_to_array`` and retrieve the ``handler_two``:
790-
to get an array and then retrieve the ``handler_two`` handler::
788+
application handlers. To retrieve a specific service from the iterator, call the
789+
``iterator_to_array()`` function and then use the ``key`` attribute to get the
790+
array element. For example, to retrieve the ``handler_two`` handler::
791791

792792
// src/Handler/HandlerCollection.php
793793
namespace App\Handler;
@@ -798,7 +798,7 @@ to get an array and then retrieve the ``handler_two`` handler::
798798
{
799799
$handlers = iterator_to_array($handlers);
800800

801-
$handlerTwo = $handlers['handler_two']:
801+
$handlerTwo = $handlers['handler_two'];
802802
}
803803
}
804804

setup/symfony_server.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ project. It understands that this is a MySQL service and creates environment
299299
variables accordingly with the service name (``database``) as a prefix:
300300
``DATABASE_URL``, ``DATABASE_HOST``, ...
301301

302+
If the service is not in the supported list below, generic environment
303+
variables are set: ``PORT``, ``IP``, and ``HOST``.
304+
302305
If the ``docker-compose.yaml`` names do not match Symfony's conventions, add a
303306
label to override the environment variables prefix:
304307

@@ -361,6 +364,20 @@ When Docker services are running, browse a page of your Symfony application and
361364
check the "Symfony Server" section in the web debug toolbar; you'll see that
362365
"Docker Compose" is "Up".
363366

367+
.. note::
368+
369+
If you don't want environment variables to be exposed for a service, set
370+
the ``com.symfony.server.service-ignore`` label to ``true``:
371+
372+
.. code-block:: yaml
373+
374+
# docker-compose.yaml
375+
services:
376+
db:
377+
ports: [3306]
378+
labels:
379+
com.symfony.server.service-ignore: true
380+
364381
If your Docker Compose file is not at the root of the project, use the
365382
``COMPOSE_FILE`` and ``COMPOSE_PROJECT_NAME`` environment variables to define
366383
its location, same as for ``docker-compose``:

testing/database.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ your project and define the new value for the ``DATABASE_URL`` env var:
1515
.. code-block:: bash
1616
1717
# .env.test.local
18-
DATABASE_URL=mysql://USERNAME:PASSWORD@127.0.0.1:3306/DB_NAME?serverVersion=5.7
18+
DATABASE_URL="mysql://USERNAME:PASSWORD@127.0.0.1:3306/DB_NAME?serverVersion=5.7"
1919
2020
.. tip::
2121

validation/custom_constraint.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. index::
22
single: Validation; Custom constraints
33

4-
How to Create a custom Validation Constraint
4+
How to Create a Custom Validation Constraint
55
============================================
66

77
You can create a custom constraint by extending the base constraint class,
@@ -14,8 +14,8 @@ Creating the Constraint Class
1414

1515
First you need to create a Constraint class and extend :class:`Symfony\\Component\\Validator\\Constraint`::
1616

17-
// src/Validator/Constraints/ContainsAlphanumeric.php
18-
namespace App\Validator\Constraints;
17+
// src/Validator/ContainsAlphanumeric.php
18+
namespace App\Validator;
1919

2020
use Symfony\Component\Validator\Constraint;
2121

@@ -54,8 +54,8 @@ when actually performing the validation.
5454

5555
The validator class only has one required method ``validate()``::
5656

57-
// src/Validator/Constraints/ContainsAlphanumericValidator.php
58-
namespace App\Validator\Constraints;
57+
// src/Validator/ContainsAlphanumericValidator.php
58+
namespace App\Validator;
5959

6060
use Symfony\Component\Validator\Constraint;
6161
use Symfony\Component\Validator\ConstraintValidator;
@@ -71,7 +71,7 @@ The validator class only has one required method ``validate()``::
7171
}
7272

7373
// custom constraints should ignore null and empty values to allow
74-
// other constraints (NotBlank, NotNull, etc.) take care of that
74+
// other constraints (NotBlank, NotNull, etc.) to take care of that
7575
if (null === $value || '' === $value) {
7676
return;
7777
}
@@ -112,7 +112,7 @@ You can use custom validators like the ones provided by Symfony itself:
112112
// src/Entity/AcmeEntity.php
113113
namespace App\Entity;
114114
115-
use App\Validator\Constraints as AcmeAssert;
115+
use App\Validator as AcmeAssert;
116116
use Symfony\Component\Validator\Constraints as Assert;
117117
118118
class AcmeEntity
@@ -135,7 +135,7 @@ You can use custom validators like the ones provided by Symfony itself:
135135
properties:
136136
name:
137137
- NotBlank: ~
138-
- App\Validator\Constraints\ContainsAlphanumeric: ~
138+
- App\Validator\ContainsAlphanumeric: ~
139139
140140
.. code-block:: xml
141141
@@ -148,7 +148,7 @@ You can use custom validators like the ones provided by Symfony itself:
148148
<class name="App\Entity\AcmeEntity">
149149
<property name="name">
150150
<constraint name="NotBlank"/>
151-
<constraint name="App\Validator\Constraints\ContainsAlphanumeric"/>
151+
<constraint name="App\Validator\ContainsAlphanumeric"/>
152152
</property>
153153
</class>
154154
</constraint-mapping>
@@ -158,7 +158,7 @@ You can use custom validators like the ones provided by Symfony itself:
158158
// src/Entity/AcmeEntity.php
159159
namespace App\Entity;
160160
161-
use App\Validator\Constraints\ContainsAlphanumeric;
161+
use App\Validator\ContainsAlphanumeric;
162162
use Symfony\Component\Validator\Constraints\NotBlank;
163163
use Symfony\Component\Validator\Mapping\ClassMetadata;
164164
@@ -246,21 +246,21 @@ not to the property:
246246
# config/validator/validation.yaml
247247
App\Entity\AcmeEntity:
248248
constraints:
249-
- App\Validator\Constraints\ProtocolClass: ~
249+
- App\Validator\ProtocolClass: ~
250250
251251
.. code-block:: xml
252252
253253
<!-- config/validator/validation.xml -->
254254
<class name="App\Entity\AcmeEntity">
255-
<constraint name="App\Validator\Constraints\ProtocolClass"/>
255+
<constraint name="App\Validator\ProtocolClass"/>
256256
</class>
257257
258258
.. code-block:: php
259259
260260
// src/Entity/AcmeEntity.php
261261
namespace App\Entity;
262262
263-
use App\Validator\Constraints\ProtocolClass;
263+
use App\Validator\ProtocolClass;
264264
use Symfony\Component\Validator\Mapping\ClassMetadata;
265265
266266
class AcmeEntity

0 commit comments

Comments
 (0)
0