Skip to content

Commit

Permalink
Merge pull request #462 from creative-commoners/pulls/2/deprecate-gra…
Browse files Browse the repository at this point in the history
…phql

API Deprecate GraphQL
  • Loading branch information
GuySartorelli authored Aug 19, 2024
2 parents 4bc9abd + 812d1a1 commit 2edf980
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/GraphQL/Operations/AbstractPublishOperationCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -32,6 +33,7 @@

/**
* Scaffolds a generic update operation for DataObjects.
* @deprecated 5.3.0 Will be moved to the silverstripe/graphql module
*/
abstract class AbstractPublishOperationCreator implements OperationCreator
{
Expand All @@ -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', Deprecation::SCOPE_CLASS);
});
}

/**
* @param SchemaModelInterface $model
* @param string $typeName
Expand Down
9 changes: 9 additions & 0 deletions src/GraphQL/Operations/CopyToStageCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -25,12 +26,20 @@
*
* copy[TypeName]ToStage(ID!, FromVersion!, FromStage!, ToStage!)
*
* @deprecated 5.3.0 Will be moved to the silverstripe/graphql module
*/
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', Deprecation::SCOPE_CLASS);
});
}

/**
* @var array
* @config
Expand Down
9 changes: 9 additions & 0 deletions src/GraphQL/Operations/PublishCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SilverStripe\Versioned\GraphQL\Operations;

use SilverStripe\GraphQL\Schema\Interfaces\OperationCreator;
use SilverStripe\Dev\Deprecation;

// GraphQL dependency is optional in versioned,
// and the following implementation relies on existence of this class (in GraphQL v4)
Expand All @@ -12,9 +13,17 @@

/**
* Scaffolds a generic update operation for DataObjects.
*
* @deprecated 5.3.0 Will be moved to the silverstripe/graphql module
*/
class PublishCreator extends AbstractPublishOperationCreator
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS);
});
}

/**
* @param string $typeName
Expand Down
10 changes: 10 additions & 0 deletions src/GraphQL/Operations/RollbackCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
*/
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', Deprecation::SCOPE_CLASS);
});
}

/**
* @var array
* @config
Expand Down
9 changes: 9 additions & 0 deletions src/GraphQL/Operations/UnpublishCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@

/**
* Scaffolds a generic update operation for DataObjects.
*
* @deprecated 5.3.0 Will be moved to the silverstripe/graphql module
*/
class UnpublishCreator extends AbstractPublishOperationCreator
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS);
});
}

/**
* @param string $typeName
* @return string
Expand Down
11 changes: 11 additions & 0 deletions src/GraphQL/Plugins/UnpublishOnDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@
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)
if (!interface_exists(ModelMutationPlugin::class)) {
return;
}

/**
* @deprecated 5.3.0 Will be moved to the silverstripe/graphql module
*/
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', Deprecation::SCOPE_CLASS);
});
}

/**
* @return string
*/
Expand Down
11 changes: 11 additions & 0 deletions src/GraphQL/Plugins/VersionedDataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,28 @@
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)
if (!interface_exists(ModelTypePlugin::class)) {
return;
}

/**
* @deprecated 5.3.0 Will be moved to the silverstripe/graphql module
*/
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', Deprecation::SCOPE_CLASS);
});
}

/**
* @return string
*/
Expand Down
11 changes: 11 additions & 0 deletions src/GraphQL/Plugins/VersionedRead.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@
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)
if (!interface_exists(ModelQueryPlugin::class)) {
return;
}

/**
* @deprecated 5.3.0 Will be moved to the silverstripe/graphql module
*/
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', Deprecation::SCOPE_CLASS);
});
}

/**
* @return string
*/
Expand Down
11 changes: 11 additions & 0 deletions src/GraphQL/Resolvers/VersionFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
class VersionFilters
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', 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().
Expand Down
11 changes: 11 additions & 0 deletions src/GraphQL/Resolvers/VersionedResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
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', Deprecation::SCOPE_CLASS);
});
}

/**
* @param DataObject $obj
* @param array $args
Expand Down

0 comments on commit 2edf980

Please sign in to comment.