Merge pull request #350 from creative-commoners/pulls/3/depr-messages

API Update deprecations
This commit is contained in:
Guy Sartorelli 2022-11-21 09:52:02 +13:00 committed by GitHub
commit 9bfef9e931
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

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

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Comments\Admin\CommentsGridFieldBulkAction;
use SilverStripe\Dev\Deprecation;
use Colymba\BulkManager\BulkAction\Handler as GridFieldBulkActionHandler;
use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPRequest;
@ -10,7 +11,7 @@ use SilverStripe\Control\HTTPResponse;
/**
* 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
{
@ -28,6 +29,11 @@ class Handler extends GridFieldBulkActionHandler
* @param HTTPRequest $request
* @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)
{
$ids = array();

View File

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