Skip to content

Commit

Permalink
BUG: Backwards compatibility patch fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfendeksilverstripe committed May 11, 2022
1 parent c4c855f commit 59a90c4
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions _legacy/SnapshotScaffoldingProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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');
}
}
}
}

0 comments on commit 59a90c4

Please sign in to comment.