Car.php in GraphQL 8.3
File
tests/modules/graphql_plugin_test/src/Plugin/GraphQL/Types/Car.phpView source
<?php
namespace Drupal\graphql_plugin_test\Plugin\GraphQL\Types;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Types\TypePluginBase;
use GraphQL\Type\Definition\ResolveInfo;
/**
* A bike type.
*
* @GraphQLType(
* id = "car",
* name = "Car",
* interfaces = {"MotorizedVehicle"},
* )
*/
class Car extends TypePluginBase {
/**
* {@inheritdoc}
*/
public function applies($object, ResolveContext $context, ResolveInfo $info) {
return $object['type'] == 'Car';
}
}