sllh/doctrine-dbal-utc-datetime
最新稳定版本:v1.0.0
Composer 安装命令:
composer require sllh/doctrine-dbal-utc-datetime
包简介
UTC DateTime type for Doctrine DBAL
关键字:
README 文档
README
UTC DateTime type for Doctrine DBAL.
Why this DBAL Type?
This special type allow you to be sure to always save any DateTime to the UTC format.
The goal is to get rid of the quite hazardous timezone management of many database vendors.
For more information, please read the official Doctrine wiki page, where this class come from.
Setup
First of all, you need to require this library through composer:
composer require sllh/doctrine-dbal-utc-datetime
Then, replace the default datetime and datetimetz DBAL types:
use Doctrine\DBAL\Types\Type; use SLLH\Doctrine\DBAL\Types\UTCDateTimeType; Type::overrideType('datetime', UTCDateTimeType::class); Type::overrideType('datetimetz', UTCDateTimeType::class);
If you are using Symfony, you can override the type trough the config.yml file:
doctrine: dbal: types: datetime: SLLH\Doctrine\DBAL\Types\UTCDateTimeType datetimetz: SLLH\Doctrine\DBAL\Types\UTCDateTimeType
And voilà! You are good to go. Happy coding!
License
This bundle is under the MIT license. See the complete license on the LICENSE file.
统计信息
- 总下载量: 37.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-25