From 768a4a7e6a2daaef0b46b46dc70464244c6d7ed5 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 15 Aug 2024 17:03:06 +1200 Subject: [PATCH] API Deprecate GraphQL --- .../Operations/AbstractPublishOperationCreator.php | 9 +++++++++ src/GraphQL/Operations/CopyToStageCreator.php | 9 +++++++++ src/GraphQL/Operations/PublishCreator.php | 3 ++- src/GraphQL/Operations/RollbackCreator.php | 10 ++++++++++ src/GraphQL/Operations/UnpublishCreator.php | 2 ++ src/GraphQL/Plugins/UnpublishOnDelete.php | 11 +++++++++++ src/GraphQL/Plugins/VersionedDataObject.php | 11 +++++++++++ src/GraphQL/Plugins/VersionedRead.php | 11 +++++++++++ src/GraphQL/Resolvers/VersionFilters.php | 11 +++++++++++ src/GraphQL/Resolvers/VersionedResolver.php | 11 +++++++++++ 10 files changed, 87 insertions(+), 1 deletion(-) diff --git a/src/GraphQL/Operations/AbstractPublishOperationCreator.php b/src/GraphQL/Operations/AbstractPublishOperationCreator.php index 577d7ab9..7d9a86bc 100644 --- a/src/GraphQL/Operations/AbstractPublishOperationCreator.php +++ b/src/GraphQL/Operations/AbstractPublishOperationCreator.php @@ -23,6 +23,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -32,6 +33,7 @@ /** * Scaffolds a generic update operation for DataObjects. + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 */ abstract class AbstractPublishOperationCreator implements OperationCreator { @@ -41,6 +43,13 @@ abstract class AbstractPublishOperationCreator implements OperationCreator 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 in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @param SchemaModelInterface $model * @param string $typeName diff --git a/src/GraphQL/Operations/CopyToStageCreator.php b/src/GraphQL/Operations/CopyToStageCreator.php index 46ca27d6..4064817f 100644 --- a/src/GraphQL/Operations/CopyToStageCreator.php +++ b/src/GraphQL/Operations/CopyToStageCreator.php @@ -13,6 +13,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -25,12 +26,20 @@ * * copy[TypeName]ToStage(ID!, FromVersion!, FromStage!, ToStage!) * + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 */ class CopyToStageCreator implements OperationCreator { use Configurable; use Injectable; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @var array * @config diff --git a/src/GraphQL/Operations/PublishCreator.php b/src/GraphQL/Operations/PublishCreator.php index 70f8ea18..fd2d32dc 100644 --- a/src/GraphQL/Operations/PublishCreator.php +++ b/src/GraphQL/Operations/PublishCreator.php @@ -12,10 +12,11 @@ /** * Scaffolds a generic update operation for DataObjects. + * + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 */ class PublishCreator extends AbstractPublishOperationCreator { - /** * @param string $typeName * @return string diff --git a/src/GraphQL/Operations/RollbackCreator.php b/src/GraphQL/Operations/RollbackCreator.php index 86bf9a70..a7b0906f 100644 --- a/src/GraphQL/Operations/RollbackCreator.php +++ b/src/GraphQL/Operations/RollbackCreator.php @@ -12,6 +12,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -23,12 +24,21 @@ * Scaffolds a "rollback recursive" operation for DataObjects. * * rollback[TypeName](ID!, ToVersion!) + * + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 */ class RollbackCreator implements OperationCreator { use Injectable; use Configurable; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @var array * @config diff --git a/src/GraphQL/Operations/UnpublishCreator.php b/src/GraphQL/Operations/UnpublishCreator.php index fb279d0a..ecb190f5 100644 --- a/src/GraphQL/Operations/UnpublishCreator.php +++ b/src/GraphQL/Operations/UnpublishCreator.php @@ -12,6 +12,8 @@ /** * Scaffolds a generic update operation for DataObjects. + * + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 */ class UnpublishCreator extends AbstractPublishOperationCreator { diff --git a/src/GraphQL/Plugins/UnpublishOnDelete.php b/src/GraphQL/Plugins/UnpublishOnDelete.php index ed47ddf0..263e3212 100644 --- a/src/GraphQL/Plugins/UnpublishOnDelete.php +++ b/src/GraphQL/Plugins/UnpublishOnDelete.php @@ -15,6 +15,7 @@ use Exception; use Closure; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -22,10 +23,20 @@ return; } +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class UnpublishOnDelete implements ModelMutationPlugin { const IDENTIFIER = 'unpublishOnDelete'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @return string */ diff --git a/src/GraphQL/Plugins/VersionedDataObject.php b/src/GraphQL/Plugins/VersionedDataObject.php index 8a947e46..3f55d94a 100644 --- a/src/GraphQL/Plugins/VersionedDataObject.php +++ b/src/GraphQL/Plugins/VersionedDataObject.php @@ -23,6 +23,7 @@ use SilverStripe\Versioned\Versioned; use Closure; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -30,10 +31,20 @@ return; } +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class VersionedDataObject implements ModelTypePlugin, SchemaUpdater { const IDENTIFIER = 'versioning'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @return string */ diff --git a/src/GraphQL/Plugins/VersionedRead.php b/src/GraphQL/Plugins/VersionedRead.php index 1bce5498..f20c744a 100644 --- a/src/GraphQL/Plugins/VersionedRead.php +++ b/src/GraphQL/Plugins/VersionedRead.php @@ -9,6 +9,7 @@ use SilverStripe\Versioned\GraphQL\Resolvers\VersionedResolver; use SilverStripe\Versioned\Versioned; use SilverStripe\View\ViewableData; +use SilverStripe\Dev\Deprecation; // GraphQL dependency is optional in versioned, // and the following implementation relies on existence of this class (in GraphQL v4) @@ -16,10 +17,20 @@ return; } +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class VersionedRead implements ModelQueryPlugin { const IDENTIFIER = 'readVersion'; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @return string */ diff --git a/src/GraphQL/Resolvers/VersionFilters.php b/src/GraphQL/Resolvers/VersionFilters.php index 24a3b094..94d1a06f 100644 --- a/src/GraphQL/Resolvers/VersionFilters.php +++ b/src/GraphQL/Resolvers/VersionFilters.php @@ -8,9 +8,20 @@ use SilverStripe\Versioned\Versioned; use InvalidArgumentException; use DateTime; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class VersionFilters { + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * Use this as a fallback where resolver results aren't queried as a DataList, * but rather use DataObject::get_one(). Example: SiteTree::get_by_link(). diff --git a/src/GraphQL/Resolvers/VersionedResolver.php b/src/GraphQL/Resolvers/VersionedResolver.php index a5c08ecb..30f09c05 100644 --- a/src/GraphQL/Resolvers/VersionedResolver.php +++ b/src/GraphQL/Resolvers/VersionedResolver.php @@ -21,11 +21,22 @@ use Exception; use Closure; use InvalidArgumentException; +use SilverStripe\Dev\Deprecation; +/** + * @deprecated 5.3.0 Will be moved to the silverstripe/graphql module in CMS 6 + */ class VersionedResolver { private static $priority = 1; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module in CMS 6', Deprecation::SCOPE_CLASS); + }); + } + /** * @param DataObject $obj * @param array $args