mirror of
https://github.com/doctrine/orm.git
synced 2026-04-25 23:48:05 +02:00
4016d6ba4b
Right now, the ORM handles the conversion of strings that happen to be default expressions for date, time and datetime columns into the corresponding value objects. Let us allow users to specify these value objects directly, and deprecate relying on the aforementioned conversion.
21 lines
439 B
PHP
21 lines
439 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use DateTime;
|
|
use Doctrine\DBAL\Schema\DefaultExpression\CurrentTimestamp;
|
|
use Doctrine\ORM\Mapping\Column;
|
|
use Doctrine\ORM\Mapping\Entity;
|
|
|
|
#[Entity]
|
|
class Message
|
|
{
|
|
#[Column(options: ['default' => 'Hello World!'])]
|
|
private string $text;
|
|
|
|
#[Column(options: ['default' => new CurrentTimestamp()], insertable: false, updatable: false)]
|
|
private DateTime $createdAt;
|
|
}
|