From 9eecdb9fb5c921e9ad59e480382503aa27046a48 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 5 Sep 2024 12:08:05 +1200 Subject: [PATCH] API Deprecate TopPage classes which are being renamed --- src/TopPage/DataExtension.php | 13 +++++++++++++ src/TopPage/FluentExtension.php | 13 +++++++++++++ src/TopPage/SiteTreeExtension.php | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/TopPage/DataExtension.php b/src/TopPage/DataExtension.php index a2d0d602..766db421 100644 --- a/src/TopPage/DataExtension.php +++ b/src/TopPage/DataExtension.php @@ -12,6 +12,7 @@ use SilverStripe\ORM\ValidationException; use SilverStripe\View\ViewableData; use SilverStripe\Forms\FieldList; +use SilverStripe\Dev\Deprecation; /** * Class DataExtension @@ -23,6 +24,8 @@ * @method SiteTree TopPage() * * @extends BaseDataExtension + * + * @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageElementExtension */ class DataExtension extends BaseDataExtension { @@ -51,6 +54,16 @@ class DataExtension extends BaseDataExtension */ private $fixedTopPageID = 0; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice( + '5.4.0', + 'Will be replaced with DNADesign\Elemental\Extensions\TopPageElementExtension', Deprecation::SCOPE_CLASS + ); + }); + } + /** * Extension point in @see DataObject::onAfterWrite() * diff --git a/src/TopPage/FluentExtension.php b/src/TopPage/FluentExtension.php index d81e86ae..10532594 100644 --- a/src/TopPage/FluentExtension.php +++ b/src/TopPage/FluentExtension.php @@ -9,6 +9,7 @@ use SilverStripe\ORM\Queries\SQLUpdate; use TractorCow\Fluent\State\FluentState; use SilverStripe\Forms\FieldList; +use SilverStripe\Dev\Deprecation; /** * Class FluentExtension @@ -19,6 +20,8 @@ * @property string $TopPageLocale * * @extends DataExtension + * + * @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageFluentElementExtension */ class FluentExtension extends DataExtension { @@ -29,6 +32,16 @@ class FluentExtension extends DataExtension 'TopPageLocale' => 'Varchar', ]; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice( + '5.4.0', + 'Will be replaced with DNADesign\Elemental\Extensions\TopPageFluentElementExtension', Deprecation::SCOPE_CLASS + ); + }); + } + public function updateCMSFields(FieldList $fields) { $fields->removeByName('TopPageID'); diff --git a/src/TopPage/SiteTreeExtension.php b/src/TopPage/SiteTreeExtension.php index 320576d6..a3f6d19d 100644 --- a/src/TopPage/SiteTreeExtension.php +++ b/src/TopPage/SiteTreeExtension.php @@ -7,6 +7,7 @@ use SilverStripe\CMS\Model\SiteTreeExtension as BaseSiteTreeExtension; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\ValidationException; +use SilverStripe\Dev\Deprecation; /** * Class SiteTreeExtension @@ -15,6 +16,8 @@ * It can be applied directly to Page, as it only takes effect in the presence of a ElementalArea. * * @extends BaseSiteTreeExtension + * + * @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageSiteTreeExtension */ class SiteTreeExtension extends BaseSiteTreeExtension { @@ -32,6 +35,16 @@ class SiteTreeExtension extends BaseSiteTreeExtension */ protected $duplicatedObjects = []; + public function __construct() + { + Deprecation::withNoReplacement(function () { + Deprecation::notice( + '5.4.0', + 'Will be replaced with DNADesign\Elemental\Extensions\TopPageSiteTreeExtension', Deprecation::SCOPE_CLASS + ); + }); + } + /** * Extension point in @see DataObject::onAfterWrite() *