the-events-calendar / ql-events

The Events Calendar binding to WPGraphQL
15 stars 7 forks source link

Return `null` for `organizers` when none are associated with the event. #30

Open justlevine opened 3 years ago

justlevine commented 3 years ago

This PR fixes organizers so it returns null if no organizers are set for the event. Fixes #13

justlevine commented 3 years ago

@bordoni What is the performance benefit of using static in this case? I ask because I've never seen resolve return as static in WPGraphQL or any of its extensions I've worked with, and I'm under the (possibly false) impression that static methods are actually slower than instantiated ones in php 7.2+ (but no idea if that holds true on a callable )

kidunot89 commented 2 years ago

@justlevine @bordoni I don't think there are any here since most resolvers don't get called on each request and this would automatically allocate a small amount of CPU/RAM to this static closure on each request, even the ones where it doesn't get called.

justlevine commented 1 year ago

@kidunot89 ultimately I even took it further, and went with setting the IDs on the model for use on the connection interface.

Feel free to change whatever you want on this PR or even just close it.