Skip to content

Commit 0dd6f34

Browse files
committed
document DatePointType
1 parent 0d01dbc commit 0dd6f34

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)