Skip to content

Commit 823c843

Browse files
committed
Minor tweaks
1 parent 2d7f46c commit 823c843

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

components/clock.rst

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

270-
.. _clock_writing-tests:
271-
272-
Storing DatePoints in Databases
273-
-------------------------------
270+
Storing DatePoints in the Database
271+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
274272

275-
If you :doc:`use Doctrine </doctrine>`, consider using the ``date_point`` Doctrine
276-
type, which converts to/from ``DatePoint`` objects automatically::
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::
277275

278276
// src/Entity/Product.php
279277
namespace App\Entity;
@@ -284,15 +282,22 @@ type, which converts to/from ``DatePoint`` objects automatically::
284282
#[ORM\Entity]
285283
class Product
286284
{
285+
// if you don't define the Doctrine type explicitly, Symfony will autodetect it:
287286
#[ORM\Column]
288-
private DatePoint $created;
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;
289292

290293
// ...
291294
}
292295

293296
.. versionadded:: 7.3
294297

295-
The `DatePointType` was introduced in Symfony 7.3.
298+
The ``DatePointType`` was introduced in Symfony 7.3.
299+
300+
.. _clock_writing-tests:
296301

297302
Writing Time-Sensitive Tests
298303
----------------------------

0 commit comments

Comments
 (0)