On Thu, 24 Jan 2019 at 14:53, Thomas Bley <ma...@thomasbley.de> wrote:

> To me it's not clear why we need all these methods, for example:
>
> $a = new A();
> $aSerialized = serialize($a->toArray());
> $aRestored = A::createFromArray(unserialize($aSerialized));
>
> Apart from security problems, problems with versioning and unreadable data
> in databases,
> I don't see many benefits from using serialize()/unserialize().
>


That looks like basically the same methods as proposed, but with different
names: class A has implemented toArray(), and it either recursively calling
toArray() on other objects, or is returning those instances for default
handling by serialize().

If the proposed functions were marked as a generic serialization interface,
as Larry suggests, they would just be standardising this exact pattern.

Regards,
-- 
Rowan Collins
[IMSoP]

Reply via email to