Skip to content

Commit c734d36

Browse files
authored
Merge branch 'symfony:7.3' into patch-1
2 parents 040b819 + ff88904 commit c734d36

File tree

107 files changed

+2499
-567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2499
-567
lines changed

components/clock.rst

+30
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,36 @@ timestamps::
267267
:method:`Symfony\\Component\\Clock\\DatePoint::getMicrosecond` methods were
268268
introduced in Symfony 7.1.
269269

270+
Storing DatePoints in the Database
271+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272+
273+
If you :doc:`use Doctrine </doctrine>` to work with databases, consider using the
274+
``date_point`` Doctrine type, which converts to/from ``DatePoint`` objects automatically::
275+
276+
// src/Entity/Product.php
277+
namespace App\Entity;
278+
279+
use Doctrine\ORM\Mapping as ORM;
280+
use Symfony\Component\Clock\DatePoint;
281+
282+
#[ORM\Entity]
283+
class Product
284+
{
285+
// if you don't define the Doctrine type explicitly, Symfony will autodetect it:
286+
#[ORM\Column]
287+
private DatePoint $createdAt;
288+
289+
// if you prefer to define the Doctrine type explicitly:
290+
#[ORM\Column(type: 'date_point')]
291+
private DatePoint $updatedAt;
292+
293+
// ...
294+
}
295+
296+
.. versionadded:: 7.3
297+
298+
The ``DatePointType`` was introduced in Symfony 7.3.
299+
270300
.. _clock_writing-tests:
271301

272302
Writing Time-Sensitive Tests

components/config/definition.rst

+48
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,25 @@ The configuration can now be written like this::
186186
->end()
187187
;
188188

189+
You can also use the ``enumClass()`` method to pass the FQCN of an enum
190+
class to the node. This will automatically set the values of the node to
191+
the cases of the enum::
192+
193+
$rootNode
194+
->children()
195+
->enumNode('delivery')
196+
->enumClass(Delivery::class)
197+
->end()
198+
->end()
199+
;
200+
201+
When using a backed enum, the values provided to the node will be cast
202+
to one of the enum cases if possible.
203+
204+
.. versionadded:: 7.3
205+
206+
The ``enumClass()`` method was introduced in Symfony 7.3.
207+
189208
Array Nodes
190209
~~~~~~~~~~~
191210

@@ -527,6 +546,30 @@ and in XML:
527546
<!-- entries-per-page: This value is only used for the search results page. -->
528547
<config entries-per-page="25"/>
529548
549+
You can also provide a URL to a full documentation page::
550+
551+
$rootNode
552+
->docUrl('Full documentation is available at https://example.com/docs/{version:major}.{version:minor}/reference.html')
553+
->children()
554+
->integerNode('entries_per_page')
555+
->defaultValue(25)
556+
->end()
557+
->end()
558+
;
559+
560+
A few placeholders are available to customize the URL:
561+
562+
* ``{version:major}``: The major version of the package currently installed
563+
* ``{version:minor}``: The minor version of the package currently installed
564+
* ``{package}``: The name of the package
565+
566+
The placeholders will be replaced when printing the configuration tree with the
567+
``config:dump-reference`` command.
568+
569+
.. versionadded:: 7.3
570+
571+
The ``docUrl()`` method was introduced in Symfony 7.3.
572+
530573
Optional Sections
531574
-----------------
532575

@@ -815,6 +858,7 @@ A validation rule always has an "if" part. You can specify this part in
815858
the following ways:
816859

817860
- ``ifTrue()``
861+
- ``ifFalse()``
818862
- ``ifString()``
819863
- ``ifNull()``
820864
- ``ifEmpty()``
@@ -833,6 +877,10 @@ A validation rule also requires a "then" part:
833877
Usually, "then" is a closure. Its return value will be used as a new value
834878
for the node, instead of the node's original value.
835879

880+
.. versionadded:: 7.3
881+
882+
The ``ifFalse()`` method was introduced in Symfony 7.3.
883+
836884
Configuring the Node Path Separator
837885
-----------------------------------
838886

components/console/helpers/formatterhelper.rst

+10-4
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,16 @@ Sometimes you want to format seconds to time. This is possible with the
129129
The first argument is the seconds to format and the second argument is the
130130
precision (default ``1``) of the result::
131131

132-
Helper::formatTime(42); // 42 secs
133-
Helper::formatTime(125); // 2 mins
134-
Helper::formatTime(125, 2); // 2 mins, 5 secs
135-
Helper::formatTime(172799, 4); // 1 day, 23 hrs, 59 mins, 59 secs
132+
Helper::formatTime(0.001); // 1 ms
133+
Helper::formatTime(42); // 42 s
134+
Helper::formatTime(125); // 2 min
135+
Helper::formatTime(125, 2); // 2 min, 5 s
136+
Helper::formatTime(172799, 4); // 1 d, 23 h, 59 min, 59 s
137+
Helper::formatTime(172799.056, 5); // 1 d, 23 h, 59 min, 59 s, 56 ms
138+
139+
.. versionadded:: 7.3
140+
141+
Support for formatting up to milliseconds was introduced in Symfony 7.3.
136142

137143
Formatting Memory
138144
-----------------

components/console/helpers/map.rst.inc

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
* :doc:`/components/console/helpers/progressbar`
44
* :doc:`/components/console/helpers/questionhelper`
55
* :doc:`/components/console/helpers/table`
6+
* :doc:`/components/console/helpers/tree`
67
* :doc:`/components/console/helpers/debug_formatter`
78
* :doc:`/components/console/helpers/cursor`

components/console/helpers/questionhelper.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,10 @@ invalid answer and will only be able to proceed if their input is valid.
480480
use Symfony\Component\Validator\Validation;
481481

482482
$question = new Question('Please enter the name of the bundle', 'AcmeDemoBundle');
483-
$validation = Validation::createCallable(new Regex([
484-
'pattern' => '/^[a-zA-Z]+Bundle$/',
485-
'message' => 'The name of the bundle should be suffixed with \'Bundle\'',
486-
]));
483+
$validation = Validation::createCallable(new Regex(
484+
pattern: '/^[a-zA-Z]+Bundle$/',
485+
message: 'The name of the bundle should be suffixed with \'Bundle\'',
486+
));
487487
$question->setValidator($validation);
488488

489489
Validating a Hidden Response

components/console/helpers/table.rst

+22-2
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,31 @@ The table style can be changed to any built-in styles via
181181
// same as calling nothing
182182
$table->setStyle('default');
183183

184-
// changes the default style to compact
184+
// changes the default style to markdown
185+
$table->setStyle('markdown');
186+
$table->render();
187+
188+
This outputs the table in the Markdown format:
189+
190+
.. code-block:: terminal
191+
192+
| ISBN | Title | Author |
193+
|---------------|--------------------------|------------------|
194+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
195+
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
196+
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
197+
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
198+
199+
.. versionadded:: 7.3
200+
201+
The ``markdown`` style was introduced in Symfony 7.3.
202+
203+
You can also set the style to ``compact``::
204+
185205
$table->setStyle('compact');
186206
$table->render();
187207

188-
This code results in:
208+
The output of this command will be:
189209

190210
.. code-block:: terminal
191211

0 commit comments

Comments
 (0)