-
-
Notifications
You must be signed in to change notification settings - Fork 932
GraphQL: Errors with nullish ManyToOne-Relation when using new ResolverFactory #6084
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
Conversation
1beabf6
to
6e82a2e
Compare
} | ||
|
||
if (null === $resourceClass && \array_key_exists($info->fieldName, $source ?? [])) { | ||
if ((null === $resourceClass || !is_iterable($body)) && \array_key_exists($info->fieldName, $source ?? [])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meanwhile I found a working solution: this tiny change fixes the issue with null
values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we check the PropertyMetadata
type for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored
6e82a2e
to
6e09f50
Compare
you can target the lowest branch, 3.x are merged back |
public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable | ||
{ | ||
return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operation) { | ||
// special treatment for nested resources without a resolver/provider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mhh this line is from the other PR right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It was introduced by other PR. I moved this block one level up, though it also gets called when nested collection is null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created another PR based on 3.2 that only contains the bugfix relevant for 3.2. This one here also contains the null
-fix for the recently introduced "nested collection" feature
862764f
to
ce02d7f
Compare
43fb7ac
to
e9ace4f
Compare
e9ace4f
to
f69ae8d
Compare
thanks cherry-picked |
This PR introduces a new the test case especially for properties and Many-To-One-Relations being
null
. It fixes the issues relevant for 3.2 and additionally provides a fix for the nested collection feature which was recently introduced on the main branch. There is another PR #6092 that contains only the fixes relevant for 3.2.