Skip to content

Commit b26fb1b

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: [DoctrineBridge] Add new DayPointType and TimePointType Doctrine type
2 parents c7bb7b2 + 318a670 commit b26fb1b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

components/clock.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,17 @@ Storing DatePoints in the Database
261261
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262262

263263
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::
265275

266276
// src/Entity/Product.php
267277
namespace App\Entity;
@@ -272,14 +282,20 @@ If you :doc:`use Doctrine </doctrine>` to work with databases, consider using th
272282
#[ORM\Entity]
273283
class Product
274284
{
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':
276286
#[ORM\Column]
277287
private DatePoint $createdAt;
278288

279289
// if you prefer to define the Doctrine type explicitly:
280290
#[ORM\Column(type: 'date_point')]
281291
private DatePoint $updatedAt;
282292

293+
#[ORM\Column(type: 'day_point')]
294+
public DatePoint $birthday;
295+
296+
#[ORM\Column(type: 'time_point')]
297+
public DatePoint $openAt;
298+
283299
// ...
284300
}
285301

0 commit comments

Comments
 (0)