Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation to deserialize on existing objects. #978

Closed
luishdez opened this issue Jul 19, 2018 · 2 comments
Closed

Add documentation to deserialize on existing objects. #978

luishdez opened this issue Jul 19, 2018 · 2 comments

Comments

@luishdez
Copy link

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes

I've review all issues and I've seen a lot of people struggling with this. This is a very common feature used to build APIs…

I've found and example in the issues using a custom InitializedObjectConstructor and then:

    jms_serializer.object_constructor:
        alias: jms_serializer.initialized_object_constructor
        public: false

    jms_serializer.initialized_object_constructor:
         class:        App\Serializer\InitializedObjectConstructor
         arguments:    ["@jms_serializer.unserialize_object_constructor"]

Then:

        $context = new DeserializationContext();
        $context->attributes->set('target', $document);

And I guess that probably this is not the best way to do it and it's not very intuitive. I bet a lot of people will thank a proper documentation and/or an easy way to do this.

@luishdez luishdez changed the title Add documentation for serialize on existing objects. Add documentation to deserialize on existing objects. Jul 19, 2018
@goetas
Copy link
Collaborator

goetas commented Mar 27, 2021

Fixed by #1308

@goetas goetas closed this as completed Mar 27, 2021
@yosvield
Copy link

How is the best way to deserialize on existing objects, i do not find in the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants