Skip to content

Commit

Permalink
API Deprecate GraphQL
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Aug 15, 2024
1 parent 4bc9abd commit 33cc4b0
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 1 deletion.
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 removed without equivalent functionality to replace it
*/
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 removed without equivalent functionality to replace it', 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 removed without equivalent functionality to replace it
*/
class CopyToStageCreator implements OperationCreator
{
use Configurable;
use Injectable;

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
});
}

/**
* @var array
* @config
Expand Down
4 changes: 3 additions & 1 deletion 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,10 +13,11 @@

/**
* Scaffolds a generic update operation for DataObjects.
*
* @deprecated 5.3.0 Will be removed without equivalent functionality to replace it
*/
class PublishCreator extends AbstractPublishOperationCreator
{

/**
* @param string $typeName
* @return string
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 removed without equivalent functionality to replace it
*/
class RollbackCreator implements OperationCreator
{
use Injectable;
use Configurable;

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
});
}

/**
* @var array
* @config
Expand Down
10 changes: 10 additions & 0 deletions src/GraphQL/Operations/UnpublishCreator.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,18 @@

/**
* Scaffolds a generic update operation for DataObjects.
*
* @deprecated 5.3.0 Will be removed without equivalent functionality to replace it
*/
class UnpublishCreator extends AbstractPublishOperationCreator
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', 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 removed without equivalent functionality to replace it
*/
class UnpublishOnDelete implements ModelMutationPlugin
{
const IDENTIFIER = 'unpublishOnDelete';

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', 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 removed without equivalent functionality to replace it
*/
class VersionedDataObject implements ModelTypePlugin, SchemaUpdater
{
const IDENTIFIER = 'versioning';

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', 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 removed without equivalent functionality to replace it
*/
class VersionedRead implements ModelQueryPlugin
{
const IDENTIFIER = 'readVersion';

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', 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 removed without equivalent functionality to replace it
*/
class VersionFilters
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', 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 removed without equivalent functionality to replace it
*/
class VersionedResolver
{
private static $priority = 1;

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
});
}

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

0 comments on commit 33cc4b0

Please sign in to comment.