Thanks to visit codestin.com
Credit goes to github.com

Skip to content

support DateTime objects in meta fields - #6096

Open
JoeJoeflyn wants to merge 1 commit into
kimai:mainfrom
JoeJoeflyn:feature/meta-datetime-support
Open

support DateTime objects in meta fields#6096
JoeJoeflyn wants to merge 1 commit into
kimai:mainfrom
JoeJoeflyn:feature/meta-datetime-support

Conversation

@JoeJoeflyn

@JoeJoeflyn JoeJoeflyn commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Closes #5833

Meta fields store values as TEXT strings. When a DateTime form type is used, saving a DateTime object silently dropped the value, and reading it back crashed because the form transformer expected a DateTimeInterface but got a string.

This adds DateTime handling to MetaTableTypeTrait, mirroring how it already converts bool, int, and float:

  • setValue() — formats DateTimeInterface to Y-m-d H:i:s before storing
  • getValue() — converts the stored string back to a DateTime for DateTimePickerType and DatePickerType

Tests added to AbstractMetaEntityTestCase covering set/get round-trip and null, running across all 6 meta entity types.

@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.76%. Comparing base (8f0514a) to head (350160f).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #6096   +/-   ##
=========================================
  Coverage     88.75%   88.76%           
- Complexity    10090    10093    +3     
=========================================
  Files           889      889           
  Lines         32152    32155    +3     
=========================================
+ Hits          28538    28542    +4     
+ Misses         3614     3613    -1     
Files with missing lines Coverage Δ
src/Entity/MetaTableTypeTrait.php 91.00% <100.00%> (+1.30%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Meta class does not allow to store DateTime objects

1 participant