serializer icon indicating copy to clipboard operation
serializer copied to clipboard

UnserializeObjectConstructor should be renamed to reflect what it actually does

Open Majkl578 opened this issue 6 years ago • 4 comments

Q A
Feature request? yes
BC Break yes

UnserializeObjectConstructor currently only delegates construction to Doctrine Instantiator, therefore the unserialize part is not valid.

Majkl578 avatar Jul 24 '18 11:07 Majkl578

actually happens the opposite.

First the DoctrineObjectConstructor is invoked, if the object is not managed by doctine then the UnserializeObjectConstructor is invoked.

goetas avatar Jul 24 '18 13:07 goetas

Huh, are we talking about the same thing? https://github.com/schmittjoh/serializer/blob/5a31421e56e1f4ea52c28816d243708743b266d0/src/Construction/UnserializeObjectConstructor.php#L17-L32

This does no unserialization on its own.

Majkl578 avatar Jul 24 '18 13:07 Majkl578

..... yeah, before the use of Doctrine\Instantiator\Instantiator was using the php unserialize trick to create an object without calling the constructor...

https://github.com/schmittjoh/serializer/blob/f1137df4d3a812c9c1aa7f9b6674b31b983f913e/src/JMS/Serializer/Construction/UnserializeObjectConstructor.php

goetas avatar Jul 24 '18 14:07 goetas

Ahhh, i see your point now... I misread the initial comment. sorry.

goetas avatar Jul 24 '18 14:07 goetas