@@ -271,7 +271,17 @@ Storing DatePoints in the Database
271
271
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272
272
273
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::
274
+ new Doctrine types:
275
+
276
+ ======================= ====================== =====
277
+ DatePoint Doctrine type Extends Doctrine type Class
278
+ ======================= ====================== =====
279
+ ``date_point `` ``datetime_immutable `` :class: `Symfony\\ Bridge\\ Doctrine\\ Types\\ DatePointType `
280
+ ``day_point `` ``date_immutable `` :class: `Symfony\\ Bridge\\ Doctrine\\ Types\\ DayPointType `
281
+ ``time_point `` ``time_immutable `` :class: `Symfony\\ Bridge\\ Doctrine\\ Types\\ TimePointType `
282
+ ======================= ====================== =====
283
+
284
+ They convert to/from ``DatePoint `` objects automatically::
275
285
276
286
// src/Entity/Product.php
277
287
namespace App\Entity;
@@ -282,21 +292,31 @@ If you :doc:`use Doctrine </doctrine>` to work with databases, consider using th
282
292
#[ORM\Entity]
283
293
class Product
284
294
{
285
- // if you don't define the Doctrine type explicitly, Symfony will autodetect it :
295
+ // if you don't define the Doctrine type explicitly, Symfony will autodetect 'date_point' :
286
296
#[ORM\Column]
287
297
private DatePoint $createdAt;
288
298
289
299
// if you prefer to define the Doctrine type explicitly:
290
300
#[ORM\Column(type: 'date_point')]
291
301
private DatePoint $updatedAt;
292
302
303
+ #[ORM\Column(type: 'day_point')]
304
+ public DatePoint $birthday;
305
+
306
+ #[ORM\Column(type: 'time_point')]
307
+ public DatePoint $openAt;
308
+
293
309
// ...
294
310
}
295
311
296
312
.. versionadded :: 7.3
297
313
298
314
The ``DatePointType `` was introduced in Symfony 7.3.
299
315
316
+ .. versionadded :: 7.4
317
+
318
+ The ``DayPointType `` and ``TimePointType `` were introduced in Symfony 7.4.
319
+
300
320
.. _clock_writing-tests :
301
321
302
322
Writing Time-Sensitive Tests
0 commit comments