doctrine / doctrine-laminas-hydrator

Doctrine hydrators for Laminas applications
https://www.doctrine-project.org/projects/doctrine-laminas-hydrator.html
MIT License
33 stars 19 forks source link

add support for datetime_immutable and datetimetz_immutable #30

Closed HeyRatFans closed 2 years ago

HeyRatFans commented 2 years ago

This PR adds support for the doctrine datetime_immutableand datetimetz_immutable types.

HeyRatFans commented 2 years ago

Changes made as suggested by @driehle. For targeting 2.2.x, I'm assuming someone will create such a branch.

driehle commented 2 years ago

@TomHAnderson Could you please create a 2.2.x branch?

TomHAnderson commented 2 years ago

@driehle done: https://github.com/doctrine/doctrine-laminas-hydrator/tree/2.2.x

driehle commented 2 years ago

@HeyRatFans Could you please fix the two coding standard issues that were raised by Github actions?

Further, your code added to DoctrineObjectTest.php doesn't do anything. Your method configureObjectManagerForSimpleEntityWithDateTimeImmutable() sets up an object manager that is not used anywhere. Besides, the type conversions are all tested in a separate file, see DoctrineObjectTypeConversionsTest.php.

Could you please undo your changes in DoctrineObjectTest.php and in DoctrineObjectTypeConversionsTest.php copy the methods testHandleTypeConversionsDatetime() and testHandleTypeConversionsDatetimez() to respective variants using DateTimeImmutable? For mocking the object manager you can use $this->configureObjectManagerForSimpleEntityWithGenericField('datetime_immutable');, i.e. no need to create an entity asset.

driehle commented 2 years ago

I added test cases, but there is still a Psalm issue. I will look into this.

driehle commented 2 years ago

2.2.0 has been released