Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(AppFramework): Add full support for date / time / datetime columns #47329

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Aug 19, 2024

Summary

This adds support for all Doctrine supported types, for the column types only the immutable variants needed to be added. But especially those types are the important ones, as our Entity class works by detecting changes through setters. Meaning if it is mutable, changes like $entity->date->modfiy() can not be detected, so the immutable types make more sense here.

Similar the parameter types needed to be added.

Enity and QBMapper needed to be adjusted so they support (auto map) those types, required when insert or update an entity.

Also added more tests, especially to make sure the mapper really serializes the values correctly.

Checklist

@susnux susnux added enhancement 3. to review Waiting for reviews labels Aug 19, 2024
@susnux susnux added this to the Nextcloud 31 milestone Aug 19, 2024
@susnux susnux force-pushed the feat/add-datetime-qbmapper-support branch from 2346049 to 2d9b552 Compare August 19, 2024 16:57
@nickvergessen
Copy link
Member

The next major (which we will have to update to soon) changed behaviour of DateTime: https://github.com/doctrine/dbal/blob/4.1.x/UPGRADE.md#bc-break-stricter-datetime-types
Can you make sure this does not cause a bc break on our side? Can we start with forward compatible code already?

@susnux
Copy link
Contributor Author

susnux commented Aug 20, 2024

@nickvergessen this is what I implemented already, whats breaking is that datetime does not allow \DateTimeImmutable anymore. Thats why I added both datetime and datetime_immutable.

lib/public/AppFramework/Db/Entity.php Outdated Show resolved Hide resolved
@nickvergessen
Copy link
Member

@susnux susnux force-pushed the feat/add-datetime-qbmapper-support branch from 478135b to 87fb634 Compare September 19, 2024 12:39
susnux and others added 3 commits September 20, 2024 03:25
This adds support for all Doctrine supported types, for the column types only the immutable variants needed to be added.
But especially those types are the important ones, as our **Entity** class works by detecting changes through setters.
Meaning if it is mutable, changes like `$entity->date->modfiy()` can not be detected, so the immutable types make more sense here.

Similar the parameter types needed to be added.

`Enity` and `QBMapper` needed to be adjusted so they support (auto map) those types, required when insert or update an entity.

Also added more tests, especially to make sure the mapper really serializes the values correctly.

Co-authored-by: Ferdinand Thiessen <[email protected]>
Co-authored-by: Côme Chilliet <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux force-pushed the feat/add-datetime-qbmapper-support branch from a236626 to 45e799b Compare September 20, 2024 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants