@@ -261,7 +261,17 @@ Storing DatePoints in the Database
261
261
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262
262
263
263
If you :doc: `use Doctrine </doctrine >` to work with databases, consider using the
264
- ``date_point `` Doctrine type, which converts to/from ``DatePoint `` objects automatically::
264
+ new Doctrine types:
265
+
266
+ ======================= ====================== =====
267
+ DatePoint Doctrine type Extends Doctrine type Class
268
+ ======================= ====================== =====
269
+ ``date_point `` ``datetime_immutable `` :class: `Symfony\\ Bridge\\ Doctrine\\ Types\\ DatePointType `
270
+ ``day_point `` ``date_immutable `` :class: `Symfony\\ Bridge\\ Doctrine\\ Types\\ DayPointType `
271
+ ``time_point `` ``time_immutable `` :class: `Symfony\\ Bridge\\ Doctrine\\ Types\\ TimePointType `
272
+ ======================= ====================== =====
273
+
274
+ They convert to/from ``DatePoint `` objects automatically::
265
275
266
276
// src/Entity/Product.php
267
277
namespace App\Entity;
@@ -272,14 +282,20 @@ If you :doc:`use Doctrine </doctrine>` to work with databases, consider using th
272
282
#[ORM\Entity]
273
283
class Product
274
284
{
275
- // if you don't define the Doctrine type explicitly, Symfony will autodetect it :
285
+ // if you don't define the Doctrine type explicitly, Symfony will autodetect 'date_point' :
276
286
#[ORM\Column]
277
287
private DatePoint $createdAt;
278
288
279
289
// if you prefer to define the Doctrine type explicitly:
280
290
#[ORM\Column(type: 'date_point')]
281
291
private DatePoint $updatedAt;
282
292
293
+ #[ORM\Column(type: 'day_point')]
294
+ public DatePoint $birthday;
295
+
296
+ #[ORM\Column(type: 'time_point')]
297
+ public DatePoint $openAt;
298
+
283
299
// ...
284
300
}
285
301
0 commit comments