Skip to content

how to get response data where $obj->create()? #23

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

Open
lyongdee opened this issue Jun 11, 2018 · 0 comments
Open

how to get response data where $obj->create()? #23

lyongdee opened this issue Jun 11, 2018 · 0 comments

Comments

@lyongdee
Copy link

lyongdee commented Jun 11, 2018

how to get response data when $obj->create()?

ScriptTagService.php

public function update(ScriptTag $scriptTag)
{
    $data = $scriptTag->exportData();
    $response = $this->request(
        '/admin/script_tags/'.$scriptTag->id.'.json', 'PUT', array(
        'script_tag' => $data
        )
    );
    $scriptTag->setData($response['script_tag']);
}

Fix:

public function create(ScriptTag &$scriptTag)
{
    $data = $scriptTag->exportData();
    $response = $this->request(
        '/admin/script_tags.json', 'POST', array(
        'script_tag' => $data
        )
    );
    //$scriptTag->setData($response['script_tag']);
    return $response['script_tag'];
}
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

No branches or pull requests

1 participant