You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using control characters like "!" in the format strings of DateTime-properties, this works just fine for deserialization, but does not for serialization. This is of course an issue with PHP's APIs and the incompatibility of format strings accepted by DateTime::format($format) and the ones accepted by DateTime::createFromFormat($format, $time). However, when using it with the serializer, this becomes an issue because there is (afaik) no way to define a separate deserialization type for a property.
Example:
Deserializing the value "2013-05-18" with type DateTime<'!Y-m-d'>, results in the following object:
When serializing this object using the exact same type definition, this results in the string "!2013-05-18" (with the "!" as part of the result string, which is of course logical, but not intended).
Do you think, that there is a good way to circumvent this issue? If we can find one, I'd be happy to contribute by submitting a PR for it.
The text was updated successfully, but these errors were encountered:
Encountered the same issue. Still no solution for that?
I even can't override serializeDateTime method without copying the whole class since it uses private methods for some reasons.
When using control characters like "!" in the format strings of DateTime-properties, this works just fine for deserialization, but does not for serialization. This is of course an issue with PHP's APIs and the incompatibility of format strings accepted by
DateTime::format($format)
and the ones accepted byDateTime::createFromFormat($format, $time)
. However, when using it with the serializer, this becomes an issue because there is (afaik) no way to define a separate deserialization type for a property.Example:
Deserializing the value "2013-05-18" with type
DateTime<'!Y-m-d'>
, results in the following object:When serializing this object using the exact same type definition, this results in the string "!2013-05-18" (with the "!" as part of the result string, which is of course logical, but not intended).
Do you think, that there is a good way to circumvent this issue? If we can find one, I'd be happy to contribute by submitting a PR for it.
The text was updated successfully, but these errors were encountered: