1 | <?php |
||
41 | class FieldResolver extends ResolverBase |
||
42 | { |
||
43 | |||
44 | /** |
||
45 | * @var mixed $model |
||
46 | */ |
||
47 | protected $model; |
||
48 | |||
49 | /** |
||
50 | * @var array $fields. |
||
51 | */ |
||
52 | protected $fields; |
||
53 | |||
54 | |||
55 | /** |
||
56 | * FieldResolver constructor. |
||
57 | * |
||
58 | * @param mixed $model The model instance. |
||
59 | * @param array $fields The fields registered for the type. |
||
60 | */ |
||
61 | public function __construct($model, array $fields ) |
||
66 | |||
67 | /** |
||
68 | * @param mixed $source The source that's passed down the GraphQL queries |
||
69 | * @param array $args The inputArgs on the field |
||
70 | * @param AppContext $context The AppContext passed down the GraphQL tree |
||
71 | * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
||
72 | * @return string |
||
73 | * @since $VID:$ |
||
74 | */ |
||
75 | public function resolve($source, $args, AppContext $context, ResolveInfo $info) |
||
114 | |||
115 | |||
116 | /** |
||
117 | * @param mixed $source |
||
118 | * @param $args |
||
119 | * @param $context |
||
120 | * @return Deferred|null |
||
121 | * @throws EE_Error |
||
122 | * @throws InvalidArgumentException |
||
123 | * @throws InvalidDataTypeException |
||
124 | * @throws InvalidInterfaceException |
||
125 | * @throws ReflectionException |
||
126 | * @throws UserError |
||
127 | * @since $VID:$ |
||
128 | */ |
||
129 | public function resolveWpUser($source, $args, $context) |
||
136 | |||
137 | |||
138 | /** |
||
139 | * @param mixed $source |
||
140 | * @return EE_Base_Class|null |
||
141 | * @throws EE_Error |
||
142 | * @throws InvalidArgumentException |
||
143 | * @throws InvalidDataTypeException |
||
144 | * @throws InvalidInterfaceException |
||
145 | * @throws ReflectionException |
||
146 | * @since $VID:$ |
||
147 | */ |
||
148 | public function resolveParent($source) |
||
152 | |||
153 | |||
154 | /** |
||
155 | * @param mixed $source |
||
156 | * @param $args |
||
157 | * @param $context |
||
158 | * @return Deferred|null |
||
159 | * @throws EE_Error |
||
160 | * @throws InvalidDataTypeException |
||
161 | * @throws InvalidInterfaceException |
||
162 | * @throws UserError |
||
163 | * @throws InvalidArgumentException |
||
164 | * @throws ReflectionException |
||
165 | * @since $VID:$ |
||
166 | */ |
||
167 | public function resolveEvent($source, $args, $context) |
||
185 | |||
186 | |||
187 | /** |
||
188 | * @param mixed $source The source instance. |
||
189 | * @return int |
||
190 | * @since $VID:$ |
||
191 | */ |
||
192 | public function resolveState($source) |
||
208 | |||
209 | |||
210 | /** |
||
211 | * @param mixed $source The source instance. |
||
212 | * @return int |
||
213 | * @since $VID:$ |
||
214 | */ |
||
215 | public function resolveCountry($source) |
||
234 | } |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: