Skip to content

Commit

Permalink
API Update deprecations (#375)
Browse files Browse the repository at this point in the history
* ENH Update deprecation messages

* API Update deprecations

* API Update deprecation message
  • Loading branch information
emteknetnz authored Oct 25, 2022
1 parent 6ebbc7d commit ece9003
Show file tree
Hide file tree
Showing 20 changed files with 155 additions and 35 deletions.
8 changes: 7 additions & 1 deletion _legacy/GraphQL/Extensions/DataObjectScaffolderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Extensions;

use SilverStripe\Dev\Deprecation;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
use SilverStripe\Core\Extension;
Expand All @@ -19,14 +20,19 @@
}

/**
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class DataObjectScaffolderExtension extends Extension
{
/**
* Adds the "Version" and "Versions" fields to any dataobject that has the Versioned extension.
* @param Manager $manager
*/
public function __construct()
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
}

public function onBeforeAddToManager(Manager $manager)
{
/* @var DataObjectScaffolder $owner */
Expand Down
8 changes: 7 additions & 1 deletion _legacy/GraphQL/Extensions/DeleteExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Extensions;

use SilverStripe\Dev\Deprecation;
use Exception;
use SilverStripe\Core\Extension;
use SilverStripe\GraphQL\Scaffolding\Scaffolders\CRUD\Delete;
Expand All @@ -18,7 +19,7 @@
/**
* Extends the @see Delete CRUD scaffolder to unpublish any items first
*
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class DeleteExtension extends Extension
{
Expand All @@ -30,6 +31,11 @@ class DeleteExtension extends Extension
* @param array $context
* @throws Exception
*/
public function __construct()
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
}

public function augmentMutation(DataList $objects, $args, $context)
{
foreach ($objects as $object) {
Expand Down
8 changes: 7 additions & 1 deletion _legacy/GraphQL/Extensions/ManagerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Extensions;

use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\Extension;
use SilverStripe\Versioned\GraphQL\Types\CopyToStageInputType;
use SilverStripe\Versioned\GraphQL\Types\VersionedInputType;
Expand All @@ -17,7 +18,7 @@
}

/**
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class ManagerExtension extends Extension
{
Expand All @@ -26,6 +27,11 @@ class ManagerExtension extends Extension
*
* @param $config
*/
public function __construct()
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
}

public function updateConfig(&$config)
{
if (!isset($config['types'])) {
Expand Down
8 changes: 7 additions & 1 deletion _legacy/GraphQL/Extensions/ReadExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Extensions;

use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\Extension;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\GraphQL\Resolvers\ApplyVersionFilters;
Expand All @@ -21,10 +22,15 @@
* Decorator for either a Read or ReadOne query scaffolder
*
* @property Read|ReadOne $owner
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class ReadExtension extends Extension
{
public function __construct()
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
}

public function updateList(DataList &$list, $args)
{
if (!isset($args[$this->argName()])) {
Expand Down
8 changes: 7 additions & 1 deletion _legacy/GraphQL/Extensions/SchemaScaffolderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Extensions;

use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\Extension;
use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\Scaffolding\Scaffolders\SchemaScaffolder;
Expand All @@ -16,7 +17,7 @@
}

/**
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class SchemaScaffolderExtension extends Extension
{
Expand All @@ -26,6 +27,11 @@ class SchemaScaffolderExtension extends Extension
*
* @param Manager $manager
*/
public function __construct()
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
}

public function onBeforeAddToManager(Manager $manager)
{
$memberType = StaticSchema::inst()->typeNameForDataObject(Member::class);
Expand Down
4 changes: 3 additions & 1 deletion _legacy/GraphQL/Operations/CopyToStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Operations;

use SilverStripe\Dev\Deprecation;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use InvalidArgumentException;
Expand All @@ -24,7 +25,7 @@
* copy[TypeName]ToStage(ID!, FromVersion!, FromStage!, ToStage!)
*
* @internal This is a low level API that might be removed in the future. Consider using the "rollback" mutation instead
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class CopyToStage extends MutationScaffolder implements OperationResolver
{
Expand All @@ -35,6 +36,7 @@ class CopyToStage extends MutationScaffolder implements OperationResolver
*/
public function __construct($dataObjectClass)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
parent::__construct(null, null, $this, $dataObjectClass);
}

Expand Down
11 changes: 10 additions & 1 deletion _legacy/GraphQL/Operations/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Operations;

use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\Security\Member;
use SilverStripe\Versioned\RecursivePublishable;
Expand All @@ -16,13 +17,21 @@
/**
* Scaffolds a generic update operation for DataObjects.
*
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class Publish extends PublishOperation
{
/**
* @param string $dataObjectClass
*
* @return string
*/
public function __construct($dataObjectClass)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
parent::__construct($dataObjectClass);
}

protected function createOperationName()
{
return 'publish' . ucfirst($this->getTypeName());
Expand Down
4 changes: 3 additions & 1 deletion _legacy/GraphQL/Operations/PublishOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Operations;

use SilverStripe\Dev\Deprecation;
use Exception;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
Expand All @@ -24,7 +25,7 @@
/**
* Scaffolds a generic update operation for DataObjects.
*
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
abstract class PublishOperation extends MutationScaffolder implements OperationResolver
{
Expand All @@ -33,6 +34,7 @@ abstract class PublishOperation extends MutationScaffolder implements OperationR
*/
public function __construct($dataObjectClass)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
parent::__construct(null, null, $this, $dataObjectClass);
}

Expand Down
4 changes: 3 additions & 1 deletion _legacy/GraphQL/Operations/ReadVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Operations;

use SilverStripe\Dev\Deprecation;
use Exception;
use SilverStripe\Core\Injector\Injectable;
use GraphQL\Type\Definition\ResolveInfo;
Expand All @@ -19,7 +20,7 @@
/**
* Scaffolds a generic read operation for DataObjects.
*
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class ReadVersions extends ListQueryScaffolder implements OperationResolver
{
Expand All @@ -32,6 +33,7 @@ class ReadVersions extends ListQueryScaffolder implements OperationResolver
*/
public function __construct($dataObjectClass, $versionTypeName)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
$this->setDataObjectClass($dataObjectClass);
$operationName = 'read' . ucfirst($versionTypeName);

Expand Down
4 changes: 3 additions & 1 deletion _legacy/GraphQL/Operations/Rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Operations;

use SilverStripe\Dev\Deprecation;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use InvalidArgumentException;
Expand All @@ -23,7 +24,7 @@
*
* rollback[TypeName](ID!, ToVersion!)
*
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class Rollback extends MutationScaffolder implements OperationResolver
{
Expand All @@ -34,6 +35,7 @@ class Rollback extends MutationScaffolder implements OperationResolver
*/
public function __construct($dataObjectClass)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
parent::__construct(null, null, $this, $dataObjectClass);
}

Expand Down
11 changes: 10 additions & 1 deletion _legacy/GraphQL/Operations/Unpublish.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned\GraphQL\Operations;

use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\Security\Member;
Expand All @@ -16,13 +17,21 @@
/**
* Scaffolds a generic update operation for DataObjects.
*
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class Unpublish extends PublishOperation
{
/**
* @param string $dataObjectClass
*
* @return string
*/
public function __construct($dataObjectClass)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
parent::__construct($dataObjectClass);
}

protected function createOperationName()
{
return 'unpublish'.ucfirst($this->getTypeName());
Expand Down
8 changes: 7 additions & 1 deletion _legacy/GraphQL/Resolvers/ApplyVersionFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\GraphQL\Resolvers;

use SilverStripe\Dev\Deprecation;
use SilverStripe\GraphQL\Scaffolding\StaticSchema;
use SilverStripe\ORM\DataList;
use SilverStripe\Versioned\Versioned;
Expand All @@ -15,7 +16,7 @@
}

/**
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class ApplyVersionFilters
{
Expand All @@ -27,6 +28,11 @@ class ApplyVersionFilters
*
* @param $versioningArgs
*/
public function __construct()
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
}

public function applyToReadingState($versioningArgs)
{
list ($mode, $archiveDate) = StaticSchema::inst()->extractKeys(
Expand Down
10 changes: 9 additions & 1 deletion _legacy/GraphQL/Types/CopyToStageInputType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace SilverStripe\Versioned\GraphQL\Types;

use SilverStripe\Dev\Deprecation;
use GraphQL\Type\Definition\Type;
use SilverStripe\GraphQL\Scaffolding\StaticSchema;
use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\TypeCreator;

// GraphQL dependency is optional in versioned,
Expand All @@ -13,7 +15,7 @@
}

/**
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class CopyToStageInputType extends TypeCreator
{
Expand All @@ -25,6 +27,12 @@ class CopyToStageInputType extends TypeCreator
/**
* @return array
*/
public function __construct(Manager $manager = null)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
parent::__construct($manager);
}

public function attributes()
{
return [
Expand Down
10 changes: 9 additions & 1 deletion _legacy/GraphQL/Types/VersionSortType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

namespace SilverStripe\Versioned\GraphQL\Types;

use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\GraphQL\Pagination\SortDirectionTypeCreator;
use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\TypeCreator;

// GraphQL dependency is optional in versioned,
Expand All @@ -14,7 +16,7 @@
}

/**
* @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality.
* @deprecated 1.8.0 Use the latest version of graphql instead
*/
class VersionSortType extends TypeCreator
{
Expand All @@ -31,6 +33,12 @@ class VersionSortType extends TypeCreator
/**
* @return array
*/
public function __construct(Manager $manager = null)
{
Deprecation::notice('1.8.0', 'Use the latest version of graphql instead', Deprecation::SCOPE_CLASS);
parent::__construct($manager);
}

public function attributes()
{
return [
Expand Down
Loading

0 comments on commit ece9003

Please sign in to comment.