simpod / doctrine-utcdatetime
Doctrine UTC DateTime
Fund package maintenance!
simPod
Installs: 150 357
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 4
Forks: 1
Open Issues: 1
Requires
- php: ^8.2
- doctrine/dbal: ^3 || ^4
Requires (Dev)
- doctrine/coding-standard: ^12.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0.0
- phpstan/phpstan-phpunit: ^1.0.0
- phpstan/phpstan-strict-rules: ^1.0.0
- phpunit/phpunit: ^11.0
README
Contains DateTime and DateTimeImmutable Doctrine DBAL types that store datetimes in UTC timezone (TIMESTAMP
type in postgres).
For more detailed explanation see Doctrine ORM docs and this comment.
For more info about usage in Doctrine ORM see Doctrine documentation. The code is mostly copied from there.
Using the UTCDateTimeType
Installation
composer require simpod/doctrine-utcdatetime
Overriding default types in Symfony
Simply copied from DoctrineExtensions' documentation:
doctrine: dbal: types: datetime: SimPod\DoctrineUtcDateTime\UTCDateTimeType datetimetz: SimPod\DoctrineUtcDateTime\UTCDateTimeType datetime_immutable: SimPod\DoctrineUtcDateTime\UTCDateTimeImmutableType datetimetz_immutable: SimPod\DoctrineUtcDateTime\UTCDateTimeImmutableType