Re: JsonSerializable New Interface method Proposal
| From: | Dean Eigenmann | Date: | Mon, 13 Jul 2015 15:06:00 +0000 |
| Subject: | Re: JsonSerializable New Interface method Proposal | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87149@lists.php.net to get a copy of this message | ||
I will update the spec for it to be a function, called something like json_decode_to($json, $class,
$mapping = []);
With mapping you could then specify with array keys map to which class property.
Sent from my iPhone
> On 13 Jul 2015, at 16:59, Rowan Collins <rowan.collins@gmail.com> wrote:
>
> guilhermeblanco@gmail.com wrote on 13/07/2015 15:19:
>> What about JsonDeserializable? I would like to have the choice to have a
>> serialize-only operation.
>
> Yeah, this would need to be a new interface, because interfaces can't have optional
> methods, so changing the existing interface would instantly break all existing implementations,
> which would be a big no-no IMHO.
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>