-
Notifications
You must be signed in to change notification settings - Fork 7
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
Return null
for organizers
when none are associated with the event.
#30
base: master
Are you sure you want to change the base?
Return null
for organizers
when none are associated with the event.
#30
Conversation
null
for organizers
when none are associated with the event.
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.
One small performance change.
@@ -29,6 +34,12 @@ public static function register_connections() { | |||
'fromType' => 'Event', | |||
'toType' => 'Organizer', | |||
'fromFieldName' => 'organizers', | |||
'resolve' => function( $source, array $args, AppContext $context, ResolveInfo $info ) { |
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.
'resolve' => function( $source, array $args, AppContext $context, ResolveInfo $info ) { | |
'resolve' => static function( $source, array $args, AppContext $context, ResolveInfo $info ) { |
@bordoni What is the performance benefit of using |
@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. |
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.
@justlevine The recommended method for resolving your initial issue is to default the empty $organizer_id
array to ["0"]
. This will force the desired empty result from the connection resolver.
@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. |
This PR fixes
organizers
so it returns null if no organizers are set for the event.Fixes #13