partitech / doctrine-timestamp
一个向 Doctrine ORM 添加时间戳类型的库(从 mmerian/doctrine-timestamp 分支而来,已不再更新)
v1.0.1
2023-02-23 09:10 UTC
Requires
- doctrine/dbal: 2.*
This package is auto-updated.
Last update: 2024-09-23 12:45:51 UTC
README
多年未更新的 mmerian/doctrine-timestamp 的分支版本。
Doctrine DBAL 的时间戳类型实现
此库将 PHP 类 DateTime 映射到数据库中的 Unix 时间戳(整数)。
安装
只需将以下内容添加到您的 composer.json 文件中
{ "require": { "partitech/doctrine-timestamp": "dev-master" } }
然后,在启动 doctrine 连接时
Type::addType('timestamp', 'DoctrineTimestamp\DBAL\Types\Timestamp'); $conn->getDatabasePlatform()->registerDoctrineTypeMapping('Timestamp', 'timestamp');