From 0dd6f3462e07172e8d8f7825ef0d175b62b74d85 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Mon, 24 Mar 2025 17:52:45 +0100 Subject: [PATCH] document DatePointType --- components/clock.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/components/clock.rst b/components/clock.rst index 5b20e6000b9..e1a631a9548 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -269,6 +269,31 @@ timestamps:: .. _clock_writing-tests: +Storing DatePoints in Databases +------------------------------- + +If you :doc:`use Doctrine `, consider using the ``date_point`` Doctrine +type, which converts to/from ``DatePoint`` objects automatically:: + + // src/Entity/Product.php + namespace App\Entity; + + use Doctrine\ORM\Mapping as ORM; + use Symfony\Component\Clock\DatePoint; + + #[ORM\Entity] + class Product + { + #[ORM\Column] + private DatePoint $created; + + // ... + } + +.. versionadded:: 7.3 + + The `DatePointType` was introduced in Symfony 7.3. + Writing Time-Sensitive Tests ----------------------------