Skip to content

Commit 2d7f46c

Browse files
committedMar 25, 2025
minor #20817 [Clock] document DatePointType (garak)
This PR was merged into the 7.3 branch. Discussion ---------- [Clock] document `DatePointType` Fix #20807 Commits ------- 0dd6f34 document DatePointType
2 parents 0d01dbc + 0dd6f34 commit 2d7f46c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
 

‎components/clock.rst

+25
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,31 @@ timestamps::
269269

270270
.. _clock_writing-tests:
271271

272+
Storing DatePoints in Databases
273+
-------------------------------
274+
275+
If you :doc:`use Doctrine </doctrine>`, consider using the ``date_point`` Doctrine
276+
type, which converts to/from ``DatePoint`` objects automatically::
277+
278+
// src/Entity/Product.php
279+
namespace App\Entity;
280+
281+
use Doctrine\ORM\Mapping as ORM;
282+
use Symfony\Component\Clock\DatePoint;
283+
284+
#[ORM\Entity]
285+
class Product
286+
{
287+
#[ORM\Column]
288+
private DatePoint $created;
289+
290+
// ...
291+
}
292+
293+
.. versionadded:: 7.3
294+
295+
The `DatePointType` was introduced in Symfony 7.3.
296+
272297
Writing Time-Sensitive Tests
273298
----------------------------
274299

0 commit comments

Comments
 (0)
Failed to load comments.