From 19a747d43464020d3f7ed3cb22224a8391a7fd6f Mon Sep 17 00:00:00 2001 From: Mohamed Alsharaf Date: Tue, 7 Sep 2021 10:21:47 +1200 Subject: [PATCH] Update readone resolver to match legacy resolver in CMS page --- _legacy/SnapshotScaffoldingProvider.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_legacy/SnapshotScaffoldingProvider.php b/_legacy/SnapshotScaffoldingProvider.php index 80b6455..79212df 100644 --- a/_legacy/SnapshotScaffoldingProvider.php +++ b/_legacy/SnapshotScaffoldingProvider.php @@ -3,14 +3,17 @@ namespace SilverStripe\SnapshotAdmin; +use SilverStripe\Admin\GraphQL\ReadOneLegacyResolver; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Core\ClassInfo; use SilverStripe\GraphQL\Scaffolding\Interfaces\ScaffoldingProvider; +use SilverStripe\GraphQL\Scaffolding\Scaffolders\CRUD\ReadOne; use SilverStripe\GraphQL\Scaffolding\Scaffolders\SchemaScaffolder; +use SilverStripe\GraphQL\Scaffolding\StaticSchema; use SilverStripe\ORM\DataObject; use SilverStripe\Security\Member; -if (!interface_exists(ScaffoldingProvider::class)) { +if (!interface_exists(ScaffoldingProvider::class) || !class_exists(ReadOneLegacyResolver::class)) { return; } @@ -46,6 +49,7 @@ public function provideGraphQLScaffolding(SchemaScaffolder $scaffolder) ->addFields($fields) ->operation(SchemaScaffolder::READ_ONE) ->addArg('filter', 'IDFilterType!') + ->setResolver(new ReadOneLegacyResolver($inst)) ->end() ->operation('rollback'); }