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

allow set serialization context #3

Merged
merged 1 commit into from
May 31, 2013
Merged

allow set serialization context #3

merged 1 commit into from
May 31, 2013

Conversation

nucleartux
Copy link
Contributor

No description provided.

@wasinger
Copy link
Owner

How and where do you call setSerializationContext()? The context most likely depends on the service method you call, so it should be configurable in config.yml per function, right? But for this to work the context also would need to be registered as a service...

wasinger pushed a commit that referenced this pull request May 31, 2013
allow set serialization context
@wasinger wasinger merged commit 958a892 into wasinger:master May 31, 2013
@nucleartux
Copy link
Contributor Author

I use this function in json-rpc service like this:

public function info($user_id)
    {
        $user = $this->getRepository('AppBundle:User')->find($user_id);
        if (!$user) {
            throw new \Exception("User not found");
        }

        $this->get('wa72_jsonrpc.jsonrpccontroller')->setSerializationContext(SerializationContext::create()->setGroups(['list', 'details']));

        return $user;
    }

@ghost
Copy link

ghost commented Jul 27, 2014

IMO we should allow to set serialization group in the function configuration.
Something like this :

wa72_json_rpc:
    functions:
        myfunction1:
            service: "mybundle.servicename"
            method: "methodofservice"
            jms_serialization_context:
                group: "my_group"
                version: "1"
                max_depth_checks: true
        anotherfunction:
            service: "bundlename.foo"
            method: "bar"
            jms_serialization_context:
                version: "1"
                max_depth_checks: false

@wasinger
Copy link
Owner

@shadypierre Your suggestion looks good, feel free to send a PR if you have some code to make this work.

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

Successfully merging this pull request may close these issues.

2 participants