Skip to content

Conversation

@macbookandrew
Copy link

Fixes #202

I’m using the woocommerce plugin and getting the same error mentioned in #202. Rather than an instance of \WPGraphQL\Model\Model, the plugin is receiving an array that looks like this:

{
    "download_url": "https:\/\/www.example.com\/?download_file=3725&order=wc_order_EYw4cHxUlpAsV&email=john.ode%40example.com&key=fa5895b4-16aa-4826-8b20-ca8fcfbdb857",
    "download_id": "fa5895b4-16aa-4826-8b20-ca8fcfbdb857",
    "product_id": 3725,
    "product_name": "Example Product - Audio",
    "product_url": "https:\/\/www.example.com\/product\/example-product\/?attribute_pa_download-options=audio",
    "download_name": "Example Product (audiobook .zip file)",
    "order_id": 10501,
    "order_key": "wc_order_EYw4cHxUlpAsV",
    "downloads_remaining": "",
    "access_expires": null,
    "file": {
        "name": "Example Product (audiobook .zip file)",
        "file": "https:\/\/example.s3.us-east-2.amazonaws.com\/pda\/www.example.com\/wp-content\/uploads\/woocommerce_uploads\/example-product-audiobook.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=…"
    }
}

Since we can’t reliably infer the model name or database ID for any possible array that the plugin might receive, I figured it was probably best to bypass creating surrogate keys.

@jspellman814
Copy link

Thanks for your contribution! I copied this to #212 and am going to close this PR and continue the conversation there.

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