robwittman / shopify-php-sdk

PHP SDK for development with the Shopify API
MIT License
64 stars 42 forks source link

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

Open lyongdee opened 6 years ago

lyongdee commented 6 years ago

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']; }