diff --git a/components/clock.rst b/components/clock.rst index c4ac88e9092..83795278873 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -271,7 +271,17 @@ Storing DatePoints in the Database ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you :doc:`use Doctrine ` to work with databases, consider using the -``date_point`` Doctrine type, which converts to/from ``DatePoint`` objects automatically:: +new Doctrine types: + +======================= ====================== ===== +DatePoint Doctrine type Extends Doctrine type Class +======================= ====================== ===== +``date_point`` ``datetime_immutable`` :class:`Symfony\\Bridge\\Doctrine\\Types\\DatePointType` +``day_point`` ``date_immutable`` :class:`Symfony\\Bridge\\Doctrine\\Types\\DayPointType` +``time_point`` ``time_immutable`` :class:`Symfony\\Bridge\\Doctrine\\Types\\TimePointType` +======================= ====================== ===== + +They convert to/from ``DatePoint`` objects automatically:: // src/Entity/Product.php namespace App\Entity; @@ -282,7 +292,7 @@ If you :doc:`use Doctrine ` to work with databases, consider using th #[ORM\Entity] class Product { - // if you don't define the Doctrine type explicitly, Symfony will autodetect it: + // if you don't define the Doctrine type explicitly, Symfony will autodetect 'date_point': #[ORM\Column] private DatePoint $createdAt; @@ -290,6 +300,12 @@ If you :doc:`use Doctrine ` to work with databases, consider using th #[ORM\Column(type: 'date_point')] private DatePoint $updatedAt; + #[ORM\Column(type: 'day_point')] + public DatePoint $birthday; + + #[ORM\Column(type: 'time_point')] + public DatePoint $openAt; + // ... } @@ -297,6 +313,10 @@ If you :doc:`use Doctrine ` to work with databases, consider using th The ``DatePointType`` was introduced in Symfony 7.3. +.. versionadded:: 7.4 + + The ``DayPointType`` and ``TimePointType`` were introduced in Symfony 7.4. + .. _clock_writing-tests: Writing Time-Sensitive Tests