Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I've added a date field from the date module that I'd like to add metadata for, so I've set the type to "date" in hook_entity_property_info().
When setting this property, it validates the value with this code in entity_property_verify_data_type() :
return is_numeric($data) && strpos($data, '.') === FALSE"
The problem is then the date field is expecting a string compatible with MySQL's datetime column format, so I either fail one validation or the other.
Is there a different data type I should be declaring that I've missed, or does the validation need improving?
Comment | File | Size | Author |
---|---|---|---|
#4 | 1104286-entity-date.patch | 352 bytes | Pedro Lozano |
#2 | 1104286-entity-date.patch | 500 bytes | Pedro Lozano |
Comments
Comment #1
fagoThe date module is integrated with the entity api, so fitting metadata is generated automatically.
Comment #2
Pedro Lozano CreditAttribution: Pedro Lozano commentedI don't know if it is related but this issue sounds like it is.
I've using this patch successfully for some sorting with dates in custom tables that I wasn't able to do.
Comment #4
Pedro Lozano CreditAttribution: Pedro Lozano commentedFixed patch.
Comment #6
fagoIndeed - date is missing here. I think it should be stored as integer though as by default this is a timestamp. Also 'datetime' is no valid data type, so I restricted it to that.
-> Committed a fix to let it be integer.