Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Adding a resolveType #835

Closed
factormaarten opened this issue Dec 8, 2021 · 1 comment
Closed

Adding a resolveType #835

factormaarten opened this issue Dec 8, 2021 · 1 comment
Assignees

Comments

@factormaarten
Copy link

factormaarten commented Dec 8, 2021

In Webonyx you can add a resolve type as seen in: https://webonyx.github.io/graphql-php/type-definitions/unions/
I'm currently resolving my query in this way:

'events' => function ($message) {
   return $message;
}

How can I add a resolve type?

My graphql is like this:

union EventTypes = UserEvent | TradeEvent

type Event {
    type: String
    payload: UserEvent
}

type UserEvent {
    user: User
}

type TradeEvent {
    trade: Trade
}
@leocavalcante
Copy link
Owner

When you use Siler\GraphQL\schema(), the second argument is an array of resolvers where the key is the type.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants