PHPackages                             vasek-purchart/doctrine-date-time-immutable-types-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. vasek-purchart/doctrine-date-time-immutable-types-bundle

ActiveLibrary[Database &amp; ORM](/categories/database)

vasek-purchart/doctrine-date-time-immutable-types-bundle
========================================================

Bundle integration of Doctrine DateTimeImmutable types for Symfony

2.0(8y ago)1085.6k3[2 PRs](https://github.com/VasekPurchart/Doctrine-Date-Time-Immutable-Types-Bundle/pulls)MITPHP

Since Jun 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/VasekPurchart/Doctrine-Date-Time-Immutable-Types-Bundle)[ Packagist](https://packagist.org/packages/vasek-purchart/doctrine-date-time-immutable-types-bundle)[ RSS](/packages/vasek-purchart-doctrine-date-time-immutable-types-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (11)Versions (11)Used By (0)

Doctrine DateTimeImmutable Types Bundle
=======================================

[](#doctrine-datetimeimmutable-types-bundle)

> In [Doctrine DBAL 2.6](https://github.com/doctrine/dbal/releases/tag/v2.6.0) immutable DateTime types were added, so this bundle no longer uses [custom DateTime types implementation](https://github.com/VasekPurchart/Doctrine-Date-Time-Immutable-Types), but rather offers control, how the immutable types are registered, offering the possibility to replace the original DateTime types.

> If you cannot upgrade to Doctrine DBAL 2.6 use [1.0 version](https://github.com/VasekPurchart/Doctrine-Date-Time-Immutable-Types-Bundle/tree/1.0) of this bundle, which uses the [`vasek-purchart/doctrine-date-time-immutable-types`](https://github.com/VasekPurchart/Doctrine-Date-Time-Immutable-Types) custom DateTime types implementation.

### Why would I want to use immutable types?

[](#why-would-i-want-to-use-immutable-types)

All Doctrine date/time based types are using `DateTime` instances, which are mutable. This can lead to breaking encapsulation and therefore bugs. For two reasons:

1. You accidentally modify a date when you are doing some computation on it:

```
