Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
[Serializer] Instantiator - Add an interface and default implementation to instantiate objects #30956
This add a new interface and default implementation to instantiate objects
OBJECT_TO_POPULATE was not keep here, as i don't think it should be the responsability of an instantiator to handle that. And if we want to have this responsability we can always add a new implementation with a decoration system.
I try to look at var exporter instantiator also and unfortunetaly @nicolas-grekas i cannot use this, since the behavior of this component is to not use the constructor, in the serializer we want to use it, or at least it used to do that and we cannot change this behavior.
But we can use var exporter implementation in a future PR (will not be the default however just another way of doing it) here if someone does not want to call the constructor.
referenced this pull request
Apr 7, 2019
@javiereguiluz Like i said on top, i was aware of that, but unfortunetaly we cannot use it as a default implementation since the var export implementation try to skip the constructor where we want to use it here, as it's the current behaviour of existing normalizers.
Like If someone was using constructor to set default values for its class, using the var exporter would break its behaviour.
One thing that would be possible however is to create a Denormalizer that use the Var Exporter Component, but it's out of scope for this PR.