Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions components/clock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,31 @@

.. _clock_writing-tests:

Storing DatePoints in Databases
-------------------------------

If you :doc:`use Doctrine </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;

Check failure on line 281 in components/clock.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[Missing class] Class, interface or trait with name "Doctrine\ORM\Mapping" does not exist
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
----------------------------

Expand Down
Loading