handle models that are not instances of the Model class #208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.