Replace StorageClass with type specific interfaces #58
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Research
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
slendium/ocd#58
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently, a
Typeserializes its value to one of theStorageClasstypes. TheStorageClassof a field is determined using reflection over the return type of theserialize()method. This has a number of disadvantages:It requires intermediate objects to indicate variants of PHP primitives, such as theBlobtype representing binary data when astringwould sufficeStorageClassenumInstead each
Typeshould implement typed serialization interfaces, allowing implementations to more gradually opt-in to all known ORM types. For example, a type that can be stored as astringwill implementStringSerializablewhich has a methodserializeToString(mixed):SerializeException|string|null.Issue #4 needs to be updated accordingly.
The downside of having multiple serialization types and allowing the implementation to select an optimal type is that each implementation would also now have to provide some sort of value serializer that implements the specific rules for converting an input value into a schema-safe database value.
It is probably easier to leave the allowed insertable/settable types open ended (ie.
mixed), and use the testing package to enforce a minimum set of types that need to be supported. See slendium/ocd-conformance-tests#6.Instead, the
TypeInfoutility should just report a single type string (and throw if the serialization return type hint ismixed,null, or a DNF type). This type string can then be used for further analysis. Implementations can throw if they don't recognize the given type.