adrenalinkin/doctrine-utc-date-time

提供Doctrine DBAL日期和时间类型,用于以UTC格式存储到数据库中

v2.0.0 2022-08-21 18:32 UTC

This package is auto-updated.

Last update: 2024-09-21 22:40:25 UTC


README

PHPUnit Coverage Status Latest Stable Version Total Downloads

介绍

组件包含DBAL日期和时间类型,可以作为Doctrine类型注册。这些类型提供了在UTC中存储日期和时间的功能。以下是可用的类型列表:

安装

打开命令行控制台,进入您的项目目录,并执行以下命令以下载此组件的最新稳定版本:

    composer require adrenalinkin/doctrine-utc-date-time

此命令要求您全局安装Composer

用法

要注册新的Doctrine类型,请使用官方说明如何使用Doctrine DBAL

注册新的单独UTC类型

# app/config/config.yml
doctrine:
    dbal:
        types:
            utc_date:     Linkin\Component\DoctrineUTCDateTime\DBAL\Types\UtcDateType
            utc_datetime: Linkin\Component\DoctrineUTCDateTime\DBAL\Types\UtcDateTimeType
            utc_time:     Linkin\Component\DoctrineUTCDateTime\DBAL\Types\UtcTimeType

此外,您还可以覆盖标准类型

# app/config/config.yml
doctrine:
    dbal:
        types:
            date:     Linkin\Component\DoctrineUTCDateTime\DBAL\Types\UtcDateType
            datetime: Linkin\Component\DoctrineUTCDateTime\DBAL\Types\UtcDateTimeType
            time:     Linkin\Component\DoctrineUTCDateTime\DBAL\Types\UtcTimeType

许可证

license