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
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
@@ -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
*/
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', Deprecation::SCOPE_CLASS);
});
}

/**
* @param SchemaModelInterface $model
* @param string $typeName
9 changes: 9 additions & 0 deletions src/GraphQL/Operations/CopyToStageCreator.php
Original file line number Diff line number Diff line change
@@ -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
*/
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
9 changes: 9 additions & 0 deletions src/GraphQL/Operations/PublishCreator.php
Original file line number Diff line number Diff line change
@@ -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)
@@ -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
10 changes: 10 additions & 0 deletions src/GraphQL/Operations/RollbackCreator.php
Original file line number Diff line number Diff line change
@@ -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
*/
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
9 changes: 9 additions & 0 deletions src/GraphQL/Operations/UnpublishCreator.php
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions src/GraphQL/Plugins/UnpublishOnDelete.php
Original file line number Diff line number Diff line change
@@ -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
*/
11 changes: 11 additions & 0 deletions src/GraphQL/Plugins/VersionedDataObject.php
Original file line number Diff line number Diff line change
@@ -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
*/
11 changes: 11 additions & 0 deletions src/GraphQL/Plugins/VersionedRead.php
Original file line number Diff line number Diff line change
@@ -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
*/
11 changes: 11 additions & 0 deletions src/GraphQL/Resolvers/VersionFilters.php
Original file line number Diff line number Diff line change
@@ -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().
11 changes: 11 additions & 0 deletions src/GraphQL/Resolvers/VersionedResolver.php
Original file line number Diff line number Diff line change
@@ -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