GraphQl: Errors with nullish ManyToOne-Relation when using new ResolverFactory
API Platform version(s) affected: 3.2
Description
ItemResolverFactory and CollectionResolverFactory are deprecated and will be removed with 4.0. So I disabled event_listeners_backward_compatibility_layer to use the new ResolverFactory and see if there are some problems with it. In general this worked fine except for one case. Many-To-One Relations that are allowed to be null and are using a custom resolver are behaving different with the new ResolverFactory. Formerly the property was just returned as null and the resolver got not called. Now the resolver gets called but failes because resolvers are not able to return null.
How to reproduce
I created a PR that adds a Behat test for this case.
Possible Solution
Additional Context
I debugged the test case and found the cause, but was not able to fix it properly without breaking other test cases. The checks for already fetched data is different in https://github.com/api-platform/core/blob/main/src/GraphQl/Resolver/Factory/ResolverFactory.php#L36, and https://github.com/api-platform/core/blob/main/src/GraphQl/Resolver/Factory/ItemResolverFactory.php#L48