Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Looking at DurationInterface I noticed some copy&paste mistakes slipped through. As dates (DateTimeInterface) durations are not primitive as getValue/setValue does not return the duration object. Attached patch fixes that.
Comment | File | Size | Author |
---|---|---|---|
d8_duration.patch | 735 bytes | fago | |
Comments
Comment #2
fagod8_duration.patch queued for re-testing.
Comment #3
BerdirNot sure I understand the argument as both implementations extend from a primitive data type.
Comment #4
fagoThe implementations yes, but not the interface. The duration is implemented as a string and therefore implements StringInterface, however the DurationInterface should not extend PrimitiveInterface as the duration itself is not primitive. According to PrimitiveInterface - it would have to use get/setValue to get/set the primitive value, i.e. the duration. However, get/setValue does not get/set a duration object as specified by Durationinterface - so extending PrimitiveInterface is wrong.
Comment #5
BerdirMakes sense.
If you have a TimeSpan, you can use it as an integer by doing an instanceof IntegerInterface, in that case, it's a primitive value. When you're working with the DurationInterface, it's not.
Comment #6
chx CreditAttribution: chx commentedIssue title of the month.
Comment #7
webchickCommitted and pushed to 8.x. Thanks!