API Update deprecations

This commit is contained in:
Steve Boyd 2022-11-16 12:13:50 +13:00
parent a88bd6fff6
commit c3ef4d6efc
3 changed files with 20 additions and 2 deletions

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Comments\Admin; namespace SilverStripe\Comments\Admin;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Comments\Model\Comment; use SilverStripe\Comments\Model\Comment;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
@ -10,13 +11,22 @@ use SilverStripe\Forms\GridField\GridField_ColumnProvider;
use SilverStripe\Forms\GridField\GridField_FormAction; use SilverStripe\Forms\GridField\GridField_FormAction;
/** /**
* @deprecated 3.2.0 {@see CommentsGridFieldApproveAction} and {@see CommentsGridFieldSpamAction} instead * @deprecated 3.2.0 Use CommentsGridFieldApproveAction CommentsGridFieldSpamAction instead
*/ */
class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_ActionProvider class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_ActionProvider
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct()
{
Deprecation::notice(
'3.2.0',
'Use CommentsGridFieldApproveAction CommentsGridFieldSpamAction instead',
Deprecation::SCOPE_CLASS
);
}
public function augmentColumns($gridField, &$columns) public function augmentColumns($gridField, &$columns)
{ {
if (!in_array('Actions', $columns ?? [])) { if (!in_array('Actions', $columns ?? [])) {

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Comments\Admin\CommentsGridFieldBulkAction; namespace SilverStripe\Comments\Admin\CommentsGridFieldBulkAction;
use SilverStripe\Dev\Deprecation;
use Colymba\BulkManager\BulkAction\Handler as GridFieldBulkActionHandler; use Colymba\BulkManager\BulkAction\Handler as GridFieldBulkActionHandler;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
@ -10,7 +11,7 @@ use SilverStripe\Control\HTTPResponse;
/** /**
* A {@link GridFieldBulkActionHandler} for bulk marking comments as spam * A {@link GridFieldBulkActionHandler} for bulk marking comments as spam
* *
* @deprecated 3.1..4.0 Abstract handlers are removed, please use concrete Spam or Approve handlers * @deprecated 3.1.0 Use concrete Spam or Approve handlers instead
*/ */
class Handler extends GridFieldBulkActionHandler class Handler extends GridFieldBulkActionHandler
{ {
@ -28,6 +29,11 @@ class Handler extends GridFieldBulkActionHandler
* @param HTTPRequest $request * @param HTTPRequest $request
* @return HTTPResponse * @return HTTPResponse
*/ */
public function __construct()
{
Deprecation::notice('3.1.0', 'Use concrete Spam or Approve handlers instead', Deprecation::SCOPE_CLASS);
}
public function spam(HTTPRequest $request) public function spam(HTTPRequest $request)
{ {
$ids = array(); $ids = array();

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Comments\Model; namespace SilverStripe\Comments\Model;
use SilverStripe\Dev\Deprecation;
use HTMLPurifier; use HTMLPurifier;
use HTMLPurifier_Config; use HTMLPurifier_Config;
use SilverStripe\Comments\Controllers\CommentingController; use SilverStripe\Comments\Controllers\CommentingController;
@ -264,6 +265,7 @@ class Comment extends DataObject
*/ */
public function getParent() public function getParent()
{ {
Deprecation::notice('4.0.0', 'Use $this->Parent() instead');
return $this->BaseClass && $this->ParentID return $this->BaseClass && $this->ParentID
? DataObject::get_by_id($this->BaseClass, $this->ParentID, true) ? DataObject::get_by_id($this->BaseClass, $this->ParentID, true)
: null; : null;