File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,29 @@ When using the Clock component, you manipulate
7575:class: `Symfony\\ Component\\ Clock\\ DatePoint ` instances. You can learn more
7676about it in :ref: `the dedicated section <clock_date-point >`.
7777
78+ Storing DatePoints in Databases
79+ -------------------------------
80+
81+ If you :doc: `use Doctrine </doctrine >`, consider using the ``date_point `` Doctrine
82+ type, which converts to/from DatePoint objects automatically::
83+
84+ // src/Entity/Product.php
85+ namespace App\Entity;
86+
87+ use Doctrine\ORM\Mapping as ORM;
88+ use Symfony\Bridge\Doctrine\Types\DatePointType;
89+ use Symfony\Component\Clock\DatePoint;
90+
91+ #[ORM\Entity(repositoryClass: ProductRepository::class)]
92+ class Product
93+ {
94+ #[ORM\Column(type: DatePointType::NAME)]
95+ private DatePoint $created;
96+
97+ // ...
98+ }
99+
100+
78101Available Clocks Implementations
79102--------------------------------
80103
You can’t perform that action at this time.
0 commit comments