Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Deprecate GraphQL #462

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
});
}

GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved
/**
* @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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not calling deprecate in __construct() because that's already being done in AbstractPublishOperationCreator

Copy link
Member Author

@emteknetnz emteknetnz Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have updated to include call to deprecate

{
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
Loading