Skip to content

Commit 13d95b4

Browse files
committed
Merge branch '6.2' into 6.3
* 6.2: [Form] Example of customizing EnumType labels Add the examples for XML and PHP config Update database.rst Update doctrine.rst validator - replace expressionLanguageSyntax with new expressionSyntax
2 parents df80641 + 4572d7b commit 13d95b4

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

doctrine.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ control behavior:
768768

769769
#[Route('/product/{category}/{slug}/comments/{comment_slug}')]
770770
public function show(
771-
#[MapEntity(mapping: ['date' => 'date', 'slug' => 'slug'])]
771+
#[MapEntity(mapping: ['category' => 'category', 'slug' => 'slug'])]
772772
Product $product
773773
#[MapEntity(mapping: ['comment_slug' => 'slug'])]
774774
Comment $comment
@@ -777,7 +777,7 @@ control behavior:
777777

778778
``exclude``
779779
Configures the properties that should be used in the ``findOneBy()``
780-
method by *excluding* one or more properties so that not *all* are used:
780+
method by *excluding* one or more properties so that not *all* are used::
781781

782782
#[Route('/product/{slug}/{date}')]
783783
public function show(

reference/constraints.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Validation Constraints Reference
1414
constraints/Type
1515

1616
constraints/Email
17-
constraints/ExpressionLanguageSyntax (deprecated)
1817
constraints/ExpressionSyntax
1918
constraints/Length
2019
constraints/Url

reference/constraints/map.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ String Constraints
1616
~~~~~~~~~~~~~~~~~~
1717

1818
* :doc:`Email </reference/constraints/Email>`
19-
* :doc:`ExpressionLanguageSyntax </reference/constraints/ExpressionLanguageSyntax>`
19+
* :doc:`ExpressionSyntax </reference/constraints/ExpressionSyntax>`
2020
* :doc:`Length </reference/constraints/Length>`
2121
* :doc:`Url </reference/constraints/Url>`
2222
* :doc:`Regex </reference/constraints/Regex>`

reference/forms/types/enum.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ short) defined somewhere in your application. This enum has to be of type
3434

3535
enum TextAlign: string
3636
{
37-
case Left = 'Left/Start aligned';
38-
case Center = 'Center/Middle aligned';
39-
case Right = 'Right/End aligned';
37+
case Left = 'Left aligned';
38+
case Center = 'Center aligned';
39+
case Right = 'Right aligned';
4040
}
4141

4242
Instead of using the values of the enumeration in a ``choices`` option, the
@@ -52,6 +52,20 @@ This will display a ``<select>`` tag with the three possible values defined in
5252
the ``TextAlign`` enum. Use the `expanded`_ and `multiple`_ options to display
5353
these values as ``<input type="checkbox">`` or ``<input type="radio">``.
5454

55+
The label displayed in the ``<option>`` elements of the ``<select>`` is the enum
56+
name. PHP defines some strict rules for these names (e.g. they can't contain
57+
dots or spaces). If you need more flexibility for these labels, use the
58+
``choice_label`` option and define a function that returns the custom label::
59+
60+
->add('textAlign', EnumType::class, [
61+
'class' => TextAlign::class,
62+
'choice_label' => match ($choice) {
63+
TextAlign::Left => 'text_align.left.label',
64+
TextAlign::Center => 'text_align.center.label',
65+
TextAlign::Right => 'text_align.right.label',
66+
},
67+
]);
68+
5569
Field Options
5670
-------------
5771

session/database.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ First, define a Symfony service for the connection to the Redis server:
5050
# uncomment the following if your Redis server requires a password
5151
# - auth:
5252
# - '%env(REDIS_PASSWORD)%'
53+
54+
# uncomment the following if your Redis server requires a user and a password (when user is not default)
55+
# - auth:
56+
# - ['%env(REDIS_USER)%','%env(REDIS_PASSWORD)%']
5357
5458
.. code-block:: xml
5559
@@ -70,6 +74,12 @@ First, define a Symfony service for the connection to the Redis server:
7074
<call method="auth">
7175
<argument>%env(REDIS_PASSWORD)%</argument>
7276
</call> -->
77+
78+
<!-- uncomment the following if your Redis server requires a user and a password (when user is not default):
79+
<call method="auth">
80+
<argument>%env(REDIS_USER)%</argument>
81+
<argument>%env(REDIS_PASSWORD)%</argument>
82+
</call> -->
7383
</service>
7484
</services>
7585
</container>
@@ -83,6 +93,8 @@ First, define a Symfony service for the connection to the Redis server:
8393
->addMethodCall('connect', ['%env(REDIS_HOST)%', '%env(int:REDIS_PORT)%'])
8494
// uncomment the following if your Redis server requires a password:
8595
// ->addMethodCall('auth', ['%env(REDIS_PASSWORD)%'])
96+
// uncomment the following if your Redis server requires a user and a password (when user is not default):
97+
// ->addMethodCall('auth', ['%env(REDIS_USER)%', '%env(REDIS_PASSWORD)%'])
8698
;
8799
88100
Now pass this ``\Redis`` connection as an argument of the service associated to the

0 commit comments

Comments
 (0)