Repository navigation
Conversation
|
👋 Hi, @kushkrg! We detected conflicts in your PR against the base branch 🙊 Ref: Syncing Your Branch Hi there, @kushkrg! 👋 It looks like this pull request does not follow our template:
Please update the description to follow the template. The Hi there, @kushkrg! 👋 Thank you for sending this PR! We expect the following in all Pull Requests (PRs).
Important We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works. If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md |
Summary
When a date attribute is assigned at runtime,
__set()mutates it to aTimeinstance before storing it, while the same attribute holds a plain string when the entity is populated from the database viainjectRawData().toRawArray()therefore returned different types for the same attribute depending on how the value got there.Changes
Entity::toRawArray()now normalizesTimeinstances held in$datesattributes back to their string representation, so the raw value is a string in both cases. The mutation-on-set behaviour itself is unchanged (existing tests assert the stored attribute is aTimeinstance), and retrieval through__get()still returnsTime.testToRawArrayReturnsStringForAssignedDateAttribute.docs/changelogs/v4.7.7.md.Verified locally: EntityTest passes (139 tests, 333 assertions).
Fixes #8302