Skip to content

Commit 4ebf474

Browse files
committed
Merge branch '4.2'
* 4.2: Show example on using a DateTimeImmutable object Describe actual traversal behaviour
2 parents 17f510d + 32e7bfc commit 4ebf474

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

reference/constraints/Valid.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,6 @@ traverse
264264

265265
**type**: ``boolean`` **default**: ``true``
266266

267-
If this constraint is applied to a property that holds an array of objects,
268-
then each object in that array will be validated only if this option is
269-
set to ``true``.
267+
If this constraint is applied to a ``Traversable``, then all containing values
268+
will be validated if this option is set to ``true``. This option is ignored on
269+
arrays: Arrays are traversed in either case. Keys are not validated.

reference/forms/types/date.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ field as **three different choice fields**::
6767
'widget' => 'choice',
6868
]);
6969

70-
If your underlying date is *not* a ``DateTime`` object (e.g. it's a unix timestamp),
71-
configure the `input`_ option.
70+
If your underlying date is *not* a ``DateTime`` object (e.g. it's a unix
71+
timestamp or a ``DateTimeImmutable`` object), configure the `input`_ option::
72+
73+
$builder->add('publishedAt', DateType::class, [
74+
'widget' => 'choice',
75+
'input' => 'datetime_immutable'
76+
]);
7277

7378
Rendering a single HTML5 Textbox
7479
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)