-
-
Notifications
You must be signed in to change notification settings - Fork 21
How to remove ToOne relationship? #74
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
Comments
Looking more closely at the source code of the However, this now also includes the relationship with its I think that setting the relationship to In the case of removing the relationship, it would probably be better to check if it's |
The fact that it results in a TypeError is a bug – it should result in a nicer validation error. I'll look into a fix.
By default, |
I'm not sure I completely understand resource linkage, but my issue with
This is confusing for our frontend developers because in some cases when a resource does not have a value for the relationship, the relationship will not be present at all, while in others it will be included and set to |
The behaviour in your first point seems odd - as long as linkage is enabled on the relationship (as it is by default), it should be present in the response, null or not. Will have a look into it. |
I double-checked and it was a mistake on my end 🤦♂️ Because I was testing how to remove the relationship at the time, I accidentally tested the first point without the |
Ah I'll reopen the issue for the |
I'm trying to remove a ToOne relationship from a resource by sending a PATCH request to the resource with the ToOne relationship like this:
This results in a TypeError with the following message:
obyz\JsonApiServer\Schema\Field\Relationship::findResourceForIdentifier(): Argument #1 ($identifier) must be of type array, null given, called in /var/www/vendor/tobyz/json-api-server/src/Schema/Field/ToOne.php on line 59
Is this a bug, or should I remove the ToOne relationship in a different way?
The text was updated successfully, but these errors were encountered: