rfc:jsonserializable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:jsonserializable [2015/07/13 13:33] – Vote decanusrfc:jsonserializable [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 35: Line 35:
  
 Unlike the ArrayObject, an object like this would not be accessable like an array, and would have an easier support of private variables as the setters are in the class itself. The interface would just ensure that a json_decode would trigger the jsonUnserialize method with the json. Unlike the ArrayObject, an object like this would not be accessable like an array, and would have an easier support of private variables as the setters are in the class itself. The interface would just ensure that a json_decode would trigger the jsonUnserialize method with the json.
 +
 +===== Updated Proposal =====
 +
 +Due to discussions, it seems the best way to implement this method is with a new function.
 +
 +<code php>
 +
 +$user = json_decode_to_class($json, User::class);
 +
 +</code>
  
 ===== Vote ====== ===== Vote ======
rfc/jsonserializable.1436794402.txt.gz · Last modified: 2017/09/22 13:28 (external edit)