db
db copied to clipboard
Supports PHPs DateTime instances
Doctrine and Cycle support PHPs DateTime
instances
https://www.doctrine-project.org/projects/doctrine-orm/en/2.15/cookbook/working-with-datetime.html
https://cycle-orm.dev/docs/advanced-datetime/current
It would be great if yiisoft/db
could support PHPs DateTime
instances for types timestamp
, datetime
, date
and time
.
$command->insert('datetime_table', ['datetime' => new DateTime()])->execute();
$datetime = (new Query($db))->select(['datetime'])->from('datetime_table')->scalar();
$datetimePhpType = $tableSchema->getColumn('datetime')->phpTypecast($datetime);
$datetimePhpType instanceof DateTimeInterface;
I can realize if you agree.
Yes, that is very convenient.
Good, I implement