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?
Comments
Comment #1
fagoThe date module is integrated with the entity api, so fitting metadata is generated automatically.
Comment #2
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 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.