diff --git a/_legacy/SnapshotScaffoldingProvider.php b/_legacy/SnapshotScaffoldingProvider.php index 96f7ccc..4c14652 100644 --- a/_legacy/SnapshotScaffoldingProvider.php +++ b/_legacy/SnapshotScaffoldingProvider.php @@ -11,7 +11,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\Security\Member; -if (!interface_exists(ScaffoldingProvider::class) || !class_exists(ReadOneLegacyResolver::class)) { +if (!interface_exists(ScaffoldingProvider::class)) { return; } @@ -49,13 +49,22 @@ public function provideGraphQLScaffolding(SchemaScaffolder $scaffolder): void $fields[] = 'AbsoluteLink'; } - $scaffolder->type($inst->baseClass()) - ->addFields($fields) - ->operation(SchemaScaffolder::READ_ONE) - ->addArg('filter', 'IDFilterType!') - ->setResolver(new ReadOneLegacyResolver($inst)) - ->end() - ->operation('rollback'); + if (class_exists(ReadOneLegacyResolver::class)) { + $scaffolder->type($inst->baseClass()) + ->addFields($fields) + ->operation(SchemaScaffolder::READ_ONE) + ->addArg('filter', 'IDFilterType!') + ->setResolver(new ReadOneLegacyResolver($inst)) + ->end() + ->operation('rollback'); + } else { + $scaffolder->type($inst->baseClass()) + ->addFields($fields) + ->operation(SchemaScaffolder::READ_ONE) + ->addArg('filter', 'IDFilterType!') + ->end() + ->operation('rollback'); + } } } }