From 3efd11bef46439cb8114c6fb0ba74a5a06d8bc1c Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 26 Feb 2025 11:50:03 +1300 Subject: [PATCH] API Deprecate API being removed in CMS 6 --- code/Controllers/CMSMain.php | 9 ++++++ code/Controllers/CMSSiteTreeFilter.php | 30 ++++++++++++++++--- .../CMSSiteTreeFilter_DeletedPages.php | 2 ++ .../CMSSiteTreeFilter_PublishedPages.php | 2 ++ .../CMSSiteTreeFilter_StatusDeletedPages.php | 2 ++ 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index a905fe1e00..48607426dc 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -1029,9 +1029,14 @@ public function getSearchContext() * Returns the search form schema for the current model * * @return string + * @deprecated 5.4.0 Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData() */ public function getSearchFieldSchema() { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData()' + ); $schemaUrl = $this->Link('schema/SearchForm'); $context = $this->getSearchContext(); @@ -1771,9 +1776,11 @@ public function childfilter(HTTPRequest $request): HTTPResponse * @param array $params Query parameters to use, or null if none present * @return CMSSiteTreeFilter The filter class * @throws InvalidArgumentException if invalid filter class is passed. + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected function getQueryFilter($params) { + Deprecation::noticeWithNoReplacment('5.4.0'); if (empty($params['FilterClass'])) { return null; } @@ -1793,9 +1800,11 @@ protected function getQueryFilter($params) * @param int $parentID Optional parent node to filter on (can't be combined with other search criteria) * @return SS_List * @throws InvalidArgumentException if invalid filter class is passed. + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ public function getList($params = [], $parentID = 0) { + Deprecation::noticeWithNoReplacment('5.4.0'); if ($filter = $this->getQueryFilter($params)) { return $filter->getFilteredPages(); } else { diff --git a/code/Controllers/CMSSiteTreeFilter.php b/code/Controllers/CMSSiteTreeFilter.php index 8124967ce8..3986b2f899 100644 --- a/code/Controllers/CMSSiteTreeFilter.php +++ b/code/Controllers/CMSSiteTreeFilter.php @@ -33,6 +33,7 @@ abstract class CMSSiteTreeFilter implements LeftAndMain_SearchFilter * Caution: Unescaped data. * * @var array + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $params = []; @@ -40,6 +41,7 @@ abstract class CMSSiteTreeFilter implements LeftAndMain_SearchFilter * List of filtered items and all their parents * * @var array + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $_cache_ids = null; @@ -50,21 +52,25 @@ abstract class CMSSiteTreeFilter implements LeftAndMain_SearchFilter * others in the complete set. * * @var array + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $_cache_highlight_ids = null; /** * @var array + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $_cache_expanded = []; /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $childrenMethod = null; /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $numChildrenMethod = 'numChildren'; @@ -104,22 +110,30 @@ public function __construct($params = null) } } + /** + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. + */ public function getChildrenMethod() { + Deprecation::noticeWithNoReplacment('5.4.0'); return $this->childrenMethod; } + /** + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. + */ public function getNumChildrenMethod() { + Deprecation::noticeWithNoReplacment('5.4.0'); return $this->numChildrenMethod; } /** - * @deprecated 5.4.0 Will be renamed to getRecordClasses() + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it */ public function getPageClasses($page) { - Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to getRecordClasses()'); + Deprecation::noticeWithNoReplacment('5.4.0'); if ($this->_cache_ids === null) { $this->populateIDs(); } @@ -142,18 +156,22 @@ abstract public function getFilteredPages(); /** * @return array Map of Page IDs to their respective ParentID values. + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it */ public function pagesIncluded() { + Deprecation::noticeWithNoReplacment('5.4.0'); return $this->mapIDs($this->getFilteredPages()); } /** * Populate the IDs of the pages returned by pagesIncluded(), also including * the necessary parent helper pages. + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it */ protected function populateIDs() { + Deprecation::noticeWithNoReplacment('5.4.0'); $parents = []; $this->_cache_ids = []; $this->_cache_highlight_ids = []; @@ -184,11 +202,11 @@ protected function populateIDs() } /** - * @deprecated 5.4.0 Will be renamed to isRecordIncluded() + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it */ public function isPageIncluded($page) { - Deprecation::noticeWithNoReplacment('5.4.0', 'Will be renamed to isRecordIncluded()'); + Deprecation::noticeWithNoReplacment('5.4.0'); if ($this->_cache_ids === null) { $this->populateIDs(); } @@ -201,9 +219,11 @@ public function isPageIncluded($page) * * @param DataList $query Unfiltered query * @return DataList Filtered query + * @deprecated 5.4.0 Will be replaced with a SearchContext subclass */ protected function applyDefaultFilters($query) { + Deprecation::noticeWithNoReplacment('5.4.0', 'Will be replaced with a SearchContext subclass'); $sng = SiteTree::singleton(); foreach ($this->params as $name => $val) { if (empty($val)) { @@ -259,9 +279,11 @@ protected function applyDefaultFilters($query) * * @param SS_List $pages * @return array + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it */ protected function mapIDs($pages) { + Deprecation::noticeWithNoReplacment('5.4.0'); $ids = []; if ($pages) { foreach ($pages as $page) { diff --git a/code/Controllers/CMSSiteTreeFilter_DeletedPages.php b/code/Controllers/CMSSiteTreeFilter_DeletedPages.php index 926f2b749f..00682ce6ab 100644 --- a/code/Controllers/CMSSiteTreeFilter_DeletedPages.php +++ b/code/Controllers/CMSSiteTreeFilter_DeletedPages.php @@ -15,11 +15,13 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $childrenMethod = "AllHistoricalChildren"; /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $numChildrenMethod = 'numHistoricalChildren'; diff --git a/code/Controllers/CMSSiteTreeFilter_PublishedPages.php b/code/Controllers/CMSSiteTreeFilter_PublishedPages.php index 0501bd7d4b..b940c0a0d7 100644 --- a/code/Controllers/CMSSiteTreeFilter_PublishedPages.php +++ b/code/Controllers/CMSSiteTreeFilter_PublishedPages.php @@ -25,11 +25,13 @@ public static function title() /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $childrenMethod = "AllHistoricalChildren"; /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $numChildrenMethod = 'numHistoricalChildren'; diff --git a/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php b/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php index 039648df71..a4f731852e 100644 --- a/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php +++ b/code/Controllers/CMSSiteTreeFilter_StatusDeletedPages.php @@ -14,11 +14,13 @@ class CMSSiteTreeFilter_StatusDeletedPages extends CMSSiteTreeFilter /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $childrenMethod = "AllHistoricalChildren"; /** * @var string + * @deprecated 5.4.0 Will be removed without equivalent functionality to replace it. */ protected $numChildrenMethod = 'numHistoricalChildren';