From 89e0f9103871259a3fdf2a6012f7bb780c44483a 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..b6f8183 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(ReadOneLegacyResolver::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'); }