Skip to content

Commit

Permalink
API Deprecate TopPage classes which are being moved
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 5, 2024
1 parent 13f6a3f commit 99ca48d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/TopPage/DataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SilverStripe\ORM\ValidationException;
use SilverStripe\View\ViewableData;
use SilverStripe\Forms\FieldList;
use SilverStripe\Dev\Deprecation;

/**
* Class DataExtension
Expand All @@ -23,6 +24,8 @@
* @method SiteTree TopPage()
*
* @extends BaseDataExtension<BaseElement|ElementalArea|static>
*
* @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageElementExtension
*/
class DataExtension extends BaseDataExtension
{
Expand Down Expand Up @@ -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()
*
Expand Down
13 changes: 13 additions & 0 deletions src/TopPage/FluentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\ORM\Queries\SQLUpdate;
use TractorCow\Fluent\State\FluentState;
use SilverStripe\Forms\FieldList;
use SilverStripe\Dev\Deprecation;

/**
* Class FluentExtension
Expand All @@ -19,6 +20,8 @@
* @property string $TopPageLocale
*
* @extends DataExtension<DataObject&static>
*
* @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageFluentElementExtension
*/
class FluentExtension extends DataExtension
{
Expand All @@ -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');
Expand Down
13 changes: 13 additions & 0 deletions src/TopPage/SiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,6 +16,8 @@
* It can be applied directly to Page, as it only takes effect in the presence of a ElementalArea.
*
* @extends BaseSiteTreeExtension<SiteTree&ElementalPageExtension&static>
*
* @deprecated 5.4.0 Will be replaced with DNADesign\Elemental\Extensions\TopPageSiteTreeExtension
*/
class SiteTreeExtension extends BaseSiteTreeExtension
{
Expand All @@ -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()
*
Expand Down

0 comments on commit 99ca48d

Please sign in to comment.