You are here

public function Car::applies in GraphQL 8.3

Checks whether this type applies to a given object.

Parameters

mixed $object: The object to check against.

\Drupal\graphql\GraphQL\Execution\ResolveContext $context: The resolve context.

\GraphQL\Type\Definition\ResolveInfo $info: The resolve info object.

Return value

null|bool TRUE if this type applies to the given object or FALSE if it doesn't.

Overrides TypePluginBase::applies

File

tests/modules/graphql_plugin_test/src/Plugin/GraphQL/Types/Car.php, line 23

Class

Car
A bike type.

Namespace

Drupal\graphql_plugin_test\Plugin\GraphQL\Types

Code

public function applies($object, ResolveContext $context, ResolveInfo $info) {
  return $object['type'] == 'Car';
}