From 81b0320809f5a55a578d4c46869c490110e3e3c7 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 19 Aug 2024 09:36:32 +1200 Subject: [PATCH] API Deprecate GraphQL --- code/GraphQL/FileFilter.php | 11 +++++++++++ code/GraphQL/Notice.php | 7 +++++++ code/GraphQL/Resolvers/AssetAdminResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/FieldResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/FileTypeResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/FolderTypeResolver.php | 11 +++++++++++ code/GraphQL/Resolvers/PublicationResolver.php | 11 +++++++++++ code/GraphQL/Schema/Builder.php | 11 +++++++++++ 8 files changed, 84 insertions(+) diff --git a/code/GraphQL/FileFilter.php b/code/GraphQL/FileFilter.php index 60c215e78..0638feb53 100644 --- a/code/GraphQL/FileFilter.php +++ b/code/GraphQL/FileFilter.php @@ -10,9 +10,20 @@ use SilverStripe\Forms\DateField; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\Filterable; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module + */ class FileFilter { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); + } + /** * Caution: Does NOT enforce canView permissions * diff --git a/code/GraphQL/Notice.php b/code/GraphQL/Notice.php index ad8aa3732..6e7567b0f 100644 --- a/code/GraphQL/Notice.php +++ b/code/GraphQL/Notice.php @@ -2,9 +2,13 @@ namespace SilverStripe\AssetAdmin\GraphQL; +use SilverStripe\Dev\Deprecation; + /** * Represents a notice related to a graphql Action. This could be a failure, * warning, or recoverable query (e.g. "are you sure you want to publish this item?") + * + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module */ class Notice { @@ -34,6 +38,9 @@ class Notice */ public function __construct($message, $noticeType, $ids = []) { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); $this->message = $message; $this->noticeType = $noticeType; $this->ids = $ids; diff --git a/code/GraphQL/Resolvers/AssetAdminResolver.php b/code/GraphQL/Resolvers/AssetAdminResolver.php index 642552fbb..f49e00c65 100644 --- a/code/GraphQL/Resolvers/AssetAdminResolver.php +++ b/code/GraphQL/Resolvers/AssetAdminResolver.php @@ -16,9 +16,20 @@ use SilverStripe\ORM\Filterable; use SilverStripe\Versioned\Versioned; use InvalidArgumentException; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module + */ class AssetAdminResolver { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); + } + public static function resolveFileInterfaceType($object) { if ($object instanceof Folder) { diff --git a/code/GraphQL/Resolvers/FieldResolver.php b/code/GraphQL/Resolvers/FieldResolver.php index 21d293012..34b7a4b47 100644 --- a/code/GraphQL/Resolvers/FieldResolver.php +++ b/code/GraphQL/Resolvers/FieldResolver.php @@ -5,9 +5,20 @@ use GraphQL\Type\Definition\ResolveInfo; use SilverStripe\GraphQL\Schema\DataObject\FieldAccessor; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module + */ class FieldResolver { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); + } + public static function resolve($obj, array $args, array $context, ResolveInfo $info) { $field = $info->fieldName; diff --git a/code/GraphQL/Resolvers/FileTypeResolver.php b/code/GraphQL/Resolvers/FileTypeResolver.php index aecd7049a..a2e04a82f 100644 --- a/code/GraphQL/Resolvers/FileTypeResolver.php +++ b/code/GraphQL/Resolvers/FileTypeResolver.php @@ -12,11 +12,22 @@ use SilverStripe\Assets\Folder; use SilverStripe\Assets\Storage\AssetContainer; use SilverStripe\Core\Injector\Injectable; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module + */ class FileTypeResolver { use Injectable; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); + } + private static $dependencies = [ 'ThumbnailGenerator' => '%$SilverStripe\AssetAdmin\Model\ThumbnailGenerator.graphql' ]; diff --git a/code/GraphQL/Resolvers/FolderTypeResolver.php b/code/GraphQL/Resolvers/FolderTypeResolver.php index a67183fa4..971e251b3 100644 --- a/code/GraphQL/Resolvers/FolderTypeResolver.php +++ b/code/GraphQL/Resolvers/FolderTypeResolver.php @@ -19,9 +19,20 @@ use Exception; use Closure; use SilverStripe\ORM\DataQuery; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module + */ class FolderTypeResolver { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); + } + /** * @param Folder $object * @param array $args diff --git a/code/GraphQL/Resolvers/PublicationResolver.php b/code/GraphQL/Resolvers/PublicationResolver.php index e7aa2f25a..18790a634 100644 --- a/code/GraphQL/Resolvers/PublicationResolver.php +++ b/code/GraphQL/Resolvers/PublicationResolver.php @@ -11,12 +11,23 @@ use SilverStripe\Versioned\RecursivePublishable; use SilverStripe\Versioned\Versioned; use InvalidArgumentException; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module + */ class PublicationResolver { const ACTION_PUBLISH = 'publish'; const ACTION_UNPUBLISH = 'unpublish'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); + } + public static function resolvePublishFiles(...$params) { return PublicationResolver::resolvePublicationOperation(PublicationResolver::ACTION_PUBLISH, ...$params); diff --git a/code/GraphQL/Schema/Builder.php b/code/GraphQL/Schema/Builder.php index 023ce348e..c9fe99f81 100644 --- a/code/GraphQL/Schema/Builder.php +++ b/code/GraphQL/Schema/Builder.php @@ -8,13 +8,24 @@ use SilverStripe\GraphQL\Schema\Schema; use SilverStripe\GraphQL\Schema\Type\Enum; use SilverStripe\ORM\ArrayLib; +use SilverStripe\Dev\Deprecation; if (!interface_exists(SchemaUpdater::class)) { return; } +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module + */ class Builder implements SchemaUpdater { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); + }); + } + public static function updateSchema(Schema $schema): void { $categoryValues = array_map(function ($category) {