Skip to content

Commit

Permalink
Merge branch '1.9' into 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Rainville committed Sep 7, 2021
2 parents 602742e + 445b148 commit 3628e23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/GraphQL/Plugins/VersionedDataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use SilverStripe\Core\Extensible;
use SilverStripe\GraphQL\Schema\DataObject\Plugin\Paginator;
use SilverStripe\GraphQL\Schema\DataObject\Plugin\ScalarDBField;
use SilverStripe\GraphQL\Schema\Exception\SchemaBuilderException;
use SilverStripe\GraphQL\Schema\Field\Field;
use SilverStripe\GraphQL\Schema\Field\ModelField;
use SilverStripe\GraphQL\Schema\Interfaces\ModelTypePlugin;
use SilverStripe\GraphQL\Schema\Interfaces\SchemaUpdater;
use SilverStripe\GraphQL\Schema\Plugin\AbstractQuerySortPlugin;
Expand Down Expand Up @@ -90,7 +92,9 @@ public function apply(ModelType $type, Schema $schema, array $config = []): void
$memberTypeName = $memberType->getModel()->getTypeName();
$resolver = ['resolver' => [VersionedResolver::class, 'resolveVersionFields']];

$type->addField('version', 'Int');
$type->addField('version', 'Int', function (ModelField $field) {
$field->addResolverAfterware([ScalarDBField::class, 'resolve']);
});

$versionType = Type::create($versionName)
->addField('author', ['type' => $memberTypeName] + $resolver)
Expand Down

0 comments on commit 3628e23

Please sign in to comment.